Skip to content

php 8.5: fix remaining deprecations - #228

Merged
falkenhawk merged 5 commits into
php85-compatfrom
php85-remaining-deprecations
Apr 7, 2026
Merged

falkenhawk merged 5 commits into
php85-compatfrom
php85-remaining-deprecations

Conversation

@falkenhawk

@falkenhawk falkenhawk commented Apr 7, 2026 •

Copy link
Copy Markdown
Member

fixes last 4 test errors on php 8.5 (after null offset fixes in #227):

1) RecursiveArrayIterator with objects as backing array

replaced with simple recursive walk in Zend_CodeGenerator_Php_Property_DefaultValue::generate().

The old code mutated iterator values via offsetSet during traversal, replacing arrays with DefaultValue objects. When the iterator then tried to descend into those replaced values, RecursiveArrayIterator called new ArrayIterator($object) - deprecated in php 8.5. On older PHP this silently yielded no children (protected properties aren't iterable), so only the top-level array was ever processed by the iterator; nested arrays were handled later by recursive generate() calls. The new _prepareArrayValue() does the same thing explicitly.

2) SplPriorityQueue::__unserialize() return type mismatch

added #[ReturnTypeWillChange] to Zend_Stdlib_SplPriorityQueue::__unserialize()

3) xml_parser_free() deprecated since 8.5 (no-op since 8.0)

guarded with PHP_VERSION_ID < 80000 in Zend_Log_Writer_StreamTest

4) ord() with empty string deprecated in 8.5

fread($this->_socket, 1) returns "" when the NTP socket times out or the server sends an incomplete response. The code checks for timeout only AFTER calling ord() on the result, so ord("") fires before the timeout handler catches it. On older PHP ord("") silently returned 0; php 8.5 deprecates this. Guarded in Zend_TimeSync_Ntp::_read().

5) testTimesync unreliable on CI

pool.ntp.org is unreachable from GitHub Actions runners (UDP 123 is not blocked - other NTP servers like time.windows.com work fine). Changed test to try multiple servers, falling back gracefully.

followup to #227

…sion for php 8.5

The old code mutated iterator values via offsetSet during traversal,
replacing arrays with DefaultValue objects. When the iterator then
tried to descend into those replaced values, RecursiveArrayIterator
called new ArrayIterator($object) - deprecated in php 8.5. On older
PHP this silently yielded no children (protected properties aren't
iterable), so only the top-level array was ever processed by the
iterator; nested arrays were handled later by recursive generate()
calls. The new _prepareArrayValue() does the same thing explicitly.
@falkenhawk
falkenhawk force-pushed the php85-remaining-deprecations branch from 74f067f to becf619 Compare April 7, 2026 13:04
@falkenhawk
falkenhawk changed the base branch from php85-compat to php85-null-array-offset April 7, 2026 13:04
@falkenhawk
falkenhawk force-pushed the php85-remaining-deprecations branch 3 times, most recently from fab7d6e to d436b3a Compare April 7, 2026 13:52
pool.ntp.org is unreachable from GitHub Actions runners.
Try time.windows.com first (confirmed working on CI), fall back to
pool.ntp.org, only mark incomplete if both fail.
@falkenhawk
falkenhawk force-pushed the php85-remaining-deprecations branch from d436b3a to 621e915 Compare April 7, 2026 14:10
@falkenhawk falkenhawk mentioned this pull request Apr 7, 2026
Base automatically changed from php85-null-array-offset to php85-compat April 7, 2026 16:34
@falkenhawk
falkenhawk marked this pull request as ready for review April 7, 2026 16:34
@falkenhawk
falkenhawk merged commit 4868ed3 into php85-compat Apr 7, 2026
10 checks passed
@falkenhawk
falkenhawk deleted the php85-remaining-deprecations branch April 7, 2026 16:34
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