Skip to content

PHP 8.6 compatibility - #28

Merged
falkenhawk merged 8 commits into
masterfrom
php86-compat
Nov 4, 2026
Merged

falkenhawk merged 8 commits into
masterfrom
php86-compat

Conversation

@falkenhawk

@falkenhawk falkenhawk commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Ensure PHP 8.6 compatibility. All changes are backward-compatible with PHP 5.3+.

followup to #25

  1. add PHP 8.6 to CI matrix

  2. replace is_integer() → is_int(), is_double() → is_float() (deprecated in PHP 8.6) - the numeric comparators call these, so on 8.6 nearly every numeric assertEquals() raised a deprecation

  3. replace spl_object_hash() (deprecated in PHP 8.6) in PHPUnit_Util_Type and PHPUnit_Util_Type_ExportContext - on PHP 8.6+ the same value is built from spl_object_id() (identical output since PHP 8.1), keeping exported object references (stdClass Object &0000...) unchanged

  4. don't return a value from mocked __destruct() - returning a value from a destructor is deprecated in PHP 8.6, and the mock generator rendered return $result for every method while generated code for all other methods stays unchanged

  5. fix is_integer() deprecation from the optional php-invoker (strict mode test timeouts) - php-invoker 1.1.4 is the last 1.1 release, so PHPUnit_Util_Invoker overrides PHP_Invoker::invoke() with is_int(), still used only when php-invoker is installed and with unchanged timeout behavior

note: deps/phpunit-mock-objects/Tests is not run by CI and already fails on master (28 failures, 2 errors), unrelated to this PR.

note: the backtick and (integer) cast deprecations in the CI log come from PEAR 1.10.18 (latest release, also unfixed on pear-core master) loaded for .phpt tests - they appear on PHP 8.5 as well, don't affect results and fix is submitted to upstream in pear/pear-core#171.

Assisted by Claude (Opus 5.5, xhigh).

on PHP 8.6+ the same value is built from spl_object_id(), its output is identical to spl_object_hash() since PHP 8.1 - exported object references stay unchanged.
The last php-invoker 1.1 release (1.1.4) calls is_integer() in PHP_Invoker::invoke(), used for test timeouts
in strict mode. PHPUnit_Util_Invoker overrides invoke() with is_int() and is still only used when php-invoker is installed.
code coverage with processUncoveredFilesFromWhitelist includes every whitelisted file, and including
PHPUnit/Util/Invoker.php without php-invoker failed on the missing PHP_Invoker parent class.
@falkenhawk
falkenhawk merged commit dcb5a70 into master Nov 4, 2026
32 checks passed
@falkenhawk
falkenhawk deleted the php86-compat branch November 4, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant