Skip to content

Commit

Permalink
Merge pull request #74 from heiglandreas/1.25.x
Browse files Browse the repository at this point in the history
Allow PHP8.3
  • Loading branch information
heiglandreas authored Nov 27, 2023
2 parents f31a150 + 037ea19 commit a73a087
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 6 deletions.
15 changes: 15 additions & 0 deletions .laminas-ci/install-apcu-extension-via-pecl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

PHP_VERSION="$1"

if ! [[ "${PHP_VERSION}" =~ 8\.3 ]]; then
echo "mongodb is only installed from pecl for PHP 8.3, ${PHP_VERSION} detected."
exit 0;
fi

set +e
apt install make

pecl install apcu
echo "extension=mongodb.so" > /etc/php/${PHP_VERSION}/mods-available/apcu.ini
phpenmod -v ${PHP} -s cli apcu
15 changes: 15 additions & 0 deletions .laminas-ci/install-memcached-extension-via-pecl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

PHP_VERSION="$1"

if ! [[ "${PHP_VERSION}" =~ 8\.3 ]]; then
echo "memcached is only installed from pecl for PHP 8.3, ${PHP_VERSION} detected."
exit 0;
fi

set +e
apt install make

pecl install memcached
echo "extension=memcached.so" > /etc/php/${PHP_VERSION}/mods-available/memcached.ini
phpenmod -v ${PHP} -s cli memcached
15 changes: 15 additions & 0 deletions .laminas-ci/install-mongodb-extension-via-pecl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

PHP_VERSION="$1"

if ! [[ "${PHP_VERSION}" =~ 8\.3 ]]; then
echo "mongodb is only installed from pecl for PHP 8.3, ${PHP_VERSION} detected."
exit 0;
fi

set +e
apt install make

pecl install mongodb
echo "extension=mongodb.so" > /etc/php/${PHP_VERSION}/mods-available/mongodb.ini
phpenmod -v ${PHP} -s cli mongodb
15 changes: 15 additions & 0 deletions .laminas-ci/install-redis-extension-via-pecl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

PHP_VERSION="$1"

if ! [[ "${PHP_VERSION}" =~ 8\.3 ]]; then
echo "redis is only installed from pecl for PHP 8.3, ${PHP_VERSION} detected."
exit 0;
fi

set +e
apt install make

pecl install redis
echo "extension=redis.so" > /etc/php/${PHP_VERSION}/mods-available/redis.ini
phpenmod -v ${PHP} -s cli redis
22 changes: 22 additions & 0 deletions .laminas-ci/pre-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

WORKING_DIRECTORY=$2
JOB=$3
PHP_VERSION=$(echo "${JOB}" | jq -r '.php')


if [ ! -z "$GITHUB_BASE_REF" ] && [[ "$GITHUB_BASE_REF" =~ ^[0-9]+\.[0-9] ]]; then
readarray -td. TARGET_BRANCH_VERSION_PARTS <<<"${GITHUB_BASE_REF}.";
unset 'TARGET_BRANCH_VERSION_PARTS[-1]';
declare -a TARGET_BRANCH_VERSION_PARTS
MAJOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[0]}
MINOR_OF_TARGET_BRANCH=${TARGET_BRANCH_VERSION_PARTS[1]}

export COMPOSER_ROOT_VERISON="${MAJOR_OF_TARGET_BRANCH}.${MINOR_OF_TARGET_BRANCH}.99"
echo "Exported COMPOSER_ROOT_VERISON as ${COMPOSER_ROOT_VERISON}"
fi

${WORKING_DIRECTORY}/.laminas-ci/install-mongodb-extension-via-pecl.sh "${PHP_VERSION}" || exit 1
${WORKING_DIRECTORY}/.laminas-ci/install-apcu-extension-via-pecl.sh "${PHP_VERSION}" || exit 1
${WORKING_DIRECTORY}/.laminas-ci/install-memcached-extension-via-pecl.sh "${PHP_VERSION}" || exit 1
${WORKING_DIRECTORY}/.laminas-ci/install-redis-extension-via-pecl.sh "${PHP_VERSION}" || exit 1
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
}
},
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0",
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
"enlightn/security-checker": "^1.10"
},
"require-dev": {
Expand Down
6 changes: 3 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions src/Check/IniFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
use Laminas\Diagnostics\Result\Failure;
use Laminas\Diagnostics\Result\ResultInterface;
use Laminas\Diagnostics\Result\Success;
use RuntimeException;

use function count;
use function is_array;
use function parse_ini_file;
use function restore_error_handler;
use function set_error_handler;
use function sprintf;

/**
Expand All @@ -22,8 +25,17 @@ class IniFile extends AbstractFileCheck
*/
protected function validateFile($file)
{
if (! is_array($ini = parse_ini_file($file)) || count($ini) < 1) {
return new Failure(sprintf('Could not parse INI file "%s"!', $file));
set_error_handler(function ($code, $message) {
throw new RuntimeException($message, $code);
});
try {
if (! is_array($ini = parse_ini_file($file)) || count($ini) < 1) {
return new Failure(sprintf('Could not parse INI file "%s"!', $file));
}
} catch (RuntimeException $e) {
return new Failure(sprintf('Could not parse INI file "%s"! %s', $file, $e->getMessage()));
} finally {
restore_error_handler();
}

return new Success();
Expand Down

0 comments on commit a73a087

Please sign in to comment.