diff --git a/.github/workflows/test-phpunit.yml b/.github/workflows/test-phpunit.yml index c4f1605bc5..e0a1af3a13 100644 --- a/.github/workflows/test-phpunit.yml +++ b/.github/workflows/test-phpunit.yml @@ -15,124 +15,15 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.5', '8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4' ] + php: [ '8.6', '8.5', '8.4', '8.3', '8.2', '8.1', '8.0', '7.4', '7.3', '7.2', '7.1', '7.0', '5.6', '5.5', '5.4' ] DB: [ 'pdo/mysql', 'pdo/pgsql', 'pdo/sqlite', 'mysqli', 'pgsql', 'sqlite' ] - compiler: [ default ] include: - - php: '8.5' - DB: 'pdo/mysql' - compiler: jit - - php: '8.5' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.5' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.5' - DB: 'mysqli' - compiler: jit - - php: '8.5' - DB: 'pgsql' - compiler: jit - - php: '8.5' - DB: 'sqlite' - - php: '8.4' - DB: 'pdo/mysql' - compiler: jit - - php: '8.4' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.4' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.4' - DB: 'mysqli' - compiler: jit - - php: '8.4' - DB: 'pgsql' - compiler: jit - - php: '8.4' - DB: 'sqlite' - - php: '8.3' - DB: 'pdo/mysql' - compiler: jit - - php: '8.3' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.3' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.3' - DB: 'mysqli' - compiler: jit - - php: '8.3' - DB: 'pgsql' - compiler: jit - - php: '8.3' - DB: 'sqlite' - - php: '8.2' - DB: 'pdo/mysql' - compiler: jit - - php: '8.2' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.2' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.2' - DB: 'mysqli' - compiler: jit - - php: '8.2' - DB: 'pgsql' - compiler: jit - - php: '8.2' - DB: 'sqlite' - compiler: jit - - php: '8.1' - DB: 'pdo/mysql' - compiler: jit - - php: '8.1' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.1' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.1' - DB: 'mysqli' - compiler: jit - - php: '8.1' - DB: 'pgsql' - compiler: jit - - php: '8.1' - DB: 'sqlite' - compiler: jit - - php: '8.0' - DB: 'pdo/mysql' - compiler: jit - - php: '8.0' - DB: 'pdo/pgsql' - compiler: jit - - php: '8.0' - DB: 'pdo/sqlite' - compiler: jit - - php: '8.0' - DB: 'mysqli' - compiler: jit - - php: '8.0' - DB: 'pgsql' - compiler: jit - - php: '8.0' - DB: 'sqlite' - compiler: jit - php: '5.6' DB: 'mysql' - compiler: default - php: '5.5' DB: 'mysql' - compiler: default - php: '5.4' DB: 'mysql' - compiler: default services: postgres: @@ -159,16 +50,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Override PHP ini values for JIT compiler - if: matrix.compiler == 'jit' - run: echo "PHP_INI_VALUES::assert.exception=1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=64M" >> $GITHUB_ENV - - name: Install PHP${{ matrix.php }} - DB ${{ matrix.DB }} uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} tools: composer, pecl - extensions: imagick, sqlite3, pgsql, mysqli, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, mbstring + extensions: sqlite3, pgsql, mysqli, pdo, pdo_mysql, pdo_pgsql, pdo_sqlite, mbstring ini-values: ${{ env.PHP_INI_VALUES }} coverage: xdebug @@ -179,7 +66,7 @@ jobs: uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.json') }} restore-keys: ${{ runner.os }}-composer- - name: Install composer dependencies run: composer install --no-progress --prefer-dist --optimize-autoloader diff --git a/.gitignore b/.gitignore index 323f06468b..7c38fa07eb 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ application/logs/* !application/*/.htaccess composer.lock +.phpunit.result.cache tests/mocks/database/ci_test.sqlite user_guide_src/build/* diff --git a/composer.json b/composer.json index 81c3ea5065..bd2f486395 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "description": "Actively maintained CodeIgniter 3 fork with support for PHP 5.4 - PHP 8.5 (and beyond). Fully backward compatible.", + "description": "Actively maintained CodeIgniter 3 fork with support for PHP 5.4 - PHP 8.6 (and beyond). Fully backward compatible.", "name": "pocketarc/codeigniter", "type": "project", "homepage": "https://github.com/pocketarc/codeigniter", @@ -19,10 +19,10 @@ "phpunit --color=always --coverage-text --configuration tests/travis/sqlite.phpunit.xml" ], "post-install-cmd": [ - "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php" + "@php tests/patch-vendor.php" ], "post-update-cmd": [ - "sed -i s/name{0}/name[0]/ vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStream.php" + "@php tests/patch-vendor.php" ] }, "require-dev": { diff --git a/readme.rst b/readme.rst index 5407e33a55..20595e4ce3 100644 --- a/readme.rst +++ b/readme.rst @@ -8,8 +8,8 @@ What is this repository? :target: https://github.com/pocketarc/codeigniter/actions/workflows/test-phpunit.yml :alt: PHPUnit Tests -.. |php| image:: https://img.shields.io/badge/PHP-5.4%20--%208.5-8892BF?logo=php - :alt: PHP 5.4 - 8.5 +.. |php| image:: https://img.shields.io/badge/PHP-5.4%20--%208.6-8892BF?logo=php + :alt: PHP 5.4 - 8.6 .. |version| image:: https://img.shields.io/packagist/v/pocketarc/codeigniter :target: https://packagist.org/packages/pocketarc/codeigniter @@ -26,7 +26,8 @@ This is a fork of CodeIgniter 3, with the goal of keeping it up to date with mod - ✅ PHP 8.2 - ✅ PHP 8.3 - ✅ PHP 8.4 -- ✅ PHP 8.5 (and beyond as they are released) +- ✅ PHP 8.5 +- ✅ PHP 8.6 (and beyond as they are released) The original CodeIgniter 3.x branch is no longer maintained, and has not been updated to work with PHP 8.2, or any newer version. This fork is intended to fill that gap. diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index df1a29491a..a53307b91b 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -56,7 +56,7 @@ * @var string * */ - const CI_VERSION = '3.4.4'; + const CI_VERSION = '3.4.5'; /* * ------------------------------------------------------ diff --git a/system/libraries/Session/PHP8SessionWrapper.php b/system/libraries/Session/PHP8SessionWrapper.php index d117d139a7..b3f53a11dd 100644 --- a/system/libraries/Session/PHP8SessionWrapper.php +++ b/system/libraries/Session/PHP8SessionWrapper.php @@ -88,7 +88,7 @@ public function gc(int $maxlifetime): mixed return $this->driver->gc($maxlifetime); } - public function updateTimestamp(string $id, string$data): bool + public function updateTimestamp(string $id, string $data): bool { return $this->driver->updateTimestamp($id, $data); } diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index be4e34497c..72596daf00 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1185,10 +1185,17 @@ public function parseResponse($fp) xml_get_current_line_number($parser)); $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return']); - xml_parser_free($parser); + if (PHP_VERSION_ID < 80000) + { + xml_parser_free($parser); + } return $r; } - xml_parser_free($parser); + + if (PHP_VERSION_ID < 80000) + { + xml_parser_free($parser); + } // Got ourselves some badness, it seems if ($this->xh['isf'] > 1) diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index 557c9912ba..21ed8ee5bb 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -261,7 +261,10 @@ public function parseRequest($data = '') sprintf('XML error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); - xml_parser_free($parser); + if (PHP_VERSION_ID < 80000) + { + xml_parser_free($parser); + } } elseif ($parser_object->xh['isf']) { @@ -269,7 +272,10 @@ public function parseRequest($data = '') } else { - xml_parser_free($parser); + if (PHP_VERSION_ID < 80000) + { + xml_parser_free($parser); + } $m = new XML_RPC_Message($parser_object->xh['method']); $plist = ''; diff --git a/tests/patch-vendor.php b/tests/patch-vendor.php new file mode 100644 index 0000000000..2e0a1c235f --- /dev/null +++ b/tests/patch-vendor.php @@ -0,0 +1,30 @@ + array( + 'return spl_object_hash($resource);' => 'return function_exists(\'spl_object_id\') ? (string) spl_object_id($resource) : spl_object_hash($resource);', + ), +); + +foreach ($patches as $file => $replacements) +{ + if ( ! is_file($file)) + { + continue; + } + + $contents = file_get_contents($file); + $patched = strtr($contents, $replacements); + + if ($patched !== $contents) + { + file_put_contents($file, $patched); + echo 'Patched '.basename($file)."\n"; + } +}