Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 3 additions & 116 deletions .github/workflows/test-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ application/logs/*
!application/*/.htaccess

composer.lock
.phpunit.result.cache
tests/mocks/database/ci_test.sqlite

user_guide_src/build/*
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": {
Expand Down
7 changes: 4 additions & 3 deletions readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion system/core/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
* @var string
*
*/
const CI_VERSION = '3.4.4';
const CI_VERSION = '3.4.5';

/*
* ------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion system/libraries/Session/PHP8SessionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
11 changes: 9 additions & 2 deletions system/libraries/Xmlrpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 8 additions & 2 deletions system/libraries/Xmlrpcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,21 @@ 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'])
{
return new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return']);
}
else
{
xml_parser_free($parser);
if (PHP_VERSION_ID < 80000)
{
xml_parser_free($parser);
}

$m = new XML_RPC_Message($parser_object->xh['method']);
$plist = '';
Expand Down
30 changes: 30 additions & 0 deletions tests/patch-vendor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* CodeIgniter uses vfsStream for running tests (fake filesystem).
* vfsStream uses spl_object_hash(), which is deprecated in PHP 8.6,
* so to keep tests passing we have to fake it.
*/

$patches = array(
__DIR__ . '/../vendor/mikey179/vfsstream/src/main/php/org/bovigo/vfs/vfsStreamFile.php' => 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";
}
}
Loading