Repository navigation
PHP 8.5 compatibility fixes - #540
Merged
Merged
Conversation
Resolve PHP 8.5 deprecations still present on master. Each category was verified to emit a deprecation on PHP 8.5 before fixing. - Zend_Feed (Rss/Atom/Element): DOMDocument::$actualEncoding was removed in PHP 8.1; use ->encoding instead. Affects all RSS/Atom output. - "Using null as an array offset" (8.5): guard with `?? ''` in Zend_Db_Select::columns(), Zend_Http_Client::_setParameter(), Zend_Form (_dissolveArrayValue/_attachToArray), Zend_Filter_Input, Zend_Navigation_Container (current/getChildren), Zend_File_Transfer_Adapter_Http, Zend_TimeSync, Zend_Translate_Adapter_Tmx. - imagedestroy() (no-op since 8.0, deprecated 8.5): call only on PHP_VERSION_ID < 80000 in Zend_Captcha_Image, Zend_Barcode_Renderer_Image. - ReflectionProperty::setAccessible() (no-op since 8.1, deprecated 8.5): call only on PHP_VERSION_ID < 80100 in Zend_Wildfire FirePhp. - Non-canonical cast alias (deprecated 8.5): (double) -> (float) in Zend_Search_Lucene Xlsx (tokenizer-checked; comment text left untouched). - Zend_CodeGenerator default-value array generation: the RecursiveArrayIterator + offsetSet-during-iteration approach calls new ArrayIterator($object) (deprecated 8.5); replaced with an explicit recursive _prepareArrayValue() helper preserving behaviour. Credit: the null-as-array-offset guards and the broader 8.5 sweep this draws from originate in the zf1s/zf1 fork, PR Shardj#227 and Shardj#225 respectively. The case-statement-semicolon deprecations from Shardj#225 are already fixed on this fork's master and are not included here.
This was referenced Jun 12, 2026
oakimov
marked this pull request as draft
June 12, 2026 08:19
_stripQuoted() runs three preg_replace() passes to strip quoted literals before _parseParameters() splits the SQL. On large statements (e.g. a big IN (?, ?, ...) clause), PCRE can exceed its backtrack limit and preg_replace() returns null instead of a string; that null then reaches preg_split() in _parseParameters(), raising "Passing null to parameter Shardj#2 ($subject) of type string is deprecated" on PHP 8.1+. Cast $sql once at the top of _stripQuoted() and fall back to the prior $sql when a pass returns null (preg_replace(...) ?? $sql), so a failed pass keeps the last good string and null never propagates. Fixes Shardj#520.
oakimov
marked this pull request as ready for review
June 12, 2026 08:23
Collaborator
|
Good job, thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves PHP 8.5 deprecations still present on
master. Each category below was confirmed to emit a deprecation on PHP 8.5 before fixing; every changed file passesphp -l.DOMDocument::$actualEncoding→->encodingZend/Feed/Rss.php,Atom.php,Element.php?? ''guards for null array offsets /array_key_exists()keysDb/Select.php,Http/Client.php,Form.php,Filter/Input.php,Navigation/Container.php,File/Transfer/Adapter/Http.php,TimeSync.php,Translate/Adapter/Tmx.phppreg_replace(...) ?? $sqlso a PCRE-limit failure can't passnulltopreg_split()Db/Statement.phpimagedestroy()called only onPHP_VERSION_ID < 80000Captcha/Image.php,Barcode/Renderer/Image.phpReflectionProperty::setAccessible()called only onPHP_VERSION_ID < 80100Wildfire/Plugin/FirePhp.php(double)→(float)Search/Lucene/Document/Xlsx.phpCodeGeneratordefault-value arrays:RecursiveArrayIterator+offsetSet-during-iteration (which callsnew ArrayIterator($object)) replaced with an explicit recursive helpernew ArrayIterator($object)deprecated in 8.5CodeGenerator/Php/Property/DefaultValue.phpCloses #520.
Notes:
token_get_all), so only the real cast operator is changed —(boolean)/(integer)appearing in doc comments is intentionally left untouched.case X;→case X:) is already fixed on this fork's master, so it is not part of this PR.Attribution
These fixes draw on the parallel PHP 8.5 work in the
zf1s/zf1fork — specifically PR #227 (null-as-array-offset guards) and PR #225 (the broader 8.5 sweep). Credit to their authors; this PR ports the equivalent changes to this fork's layout and to whatmasterhere still needs. TheDb/Statement.phpfix follows the approach proposed in #520.Testing
php -lclean on all 17 changed files (PHP 8.5.7).CodeGeneratorrefactor produces valid output for nested arrays with 0 deprecations.