Skip to content

Align tests with PHP 8.6 changes to ext/tidy and ext/intl - #644

Merged
nicolas-grekas merged 1 commit into
1.xfrom
php86-not-serializable-tidynode
Aug 7, 2026
Merged

Align tests with PHP 8.6 changes to ext/tidy and ext/intl#644
nicolas-grekas merged 1 commit into
1.xfrom
php86-not-serializable-tidynode

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Member

Fixes the two failures of the PHPUnit Tests (8.6, apc, apcu, ... intl-73.2 ...) job, which is red on 1.x itself, plus an unrelated flaky test that failed in the same run.

DeepCloneTest::testTidyNodeRoundTrip

php-src 4782ec55aae (Add NOT_SERIALIZABLE to XMLWriter, XMLReader, SNMP, tidy, and tidyNode, php/php-src#21694, master only) marks tidyNode @not-serializable — it wraps a libTidy handle and "segfaults on use" once unserialized.

ext/deepclone honours ZEND_ACC_NOT_SERIALIZABLE, so on 8.6 both engines now refuse the node: the extension via that flag, the polyfill because unserialize('O:8:"tidyNode":0:{}') throws. Same exception, same message — only the test was stale.

Per the design principle that the deepclone polyfill mirrors the newest native state rather than each intermediate version, tidyNode joins NOT_ROUND_TRIPPABLE. The extension is more lenient below 8.6 (tidyNode is final and bare-instantiable there, so it passes the probe), so the test keeps the round-trip expectation for that combination.

NormalizerTest::testNormalizeWithInvalidForm

php-src 94e8c54ef27 (ext/intl: Fix various error messages, php/php-src#22828, master only) dropped the doubled article introduced back when intl warnings were promoted to exceptions. Both the polyfill and its test hardcoded must be a a valid, so the message is now conditional on PHP_VERSION_ID >= 80600.

Php73Test::testHardwareTimeAsArrayNanos

Unrelated, and the reason the (7.3, apc, apcu, ...) job failed in the same run: the test asserted $hrtime2[0] - $hrtime[0] === 0, which fails whenever the two hrtime() calls straddle a whole second. It now measures total elapsed nanoseconds and checks the sub-second component stays in range.

php-src 4782ec55aae added ZEND_ACC_NOT_SERIALIZABLE to tidyNode, which
ext/deepclone honours by refusing the class. Following the design principle
that the deepclone polyfill mirrors the newest native state, tidyNode joins
the classes it rejects on every version; the extension itself only rejects it
on 8.6+, so the test keeps the round-trip expectation for that case.

php-src 94e8c54ef27 removed the doubled article from the ValueError thrown by
normalizer_normalize(), so the message is now conditional on the version.

Also de-flake Php73Test::testHardwareTimeAsArrayNanos: it compared the two
hrtime() components separately, which fails whenever the pair straddles a
whole second.
@nicolas-grekas
nicolas-grekas merged commit e7bbde3 into 1.x Aug 7, 2026
59 of 60 checks passed
@nicolas-grekas
nicolas-grekas deleted the php86-not-serializable-tidynode branch August 7, 2026 11:40
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.

2 participants