Stdlib: xml_parser_set_option(null) E_WARNING string|int|bool (#30652) - #30752
Merged
Conversation
php-src 8.3+ xml.c warns on a non-string|int|bool $value then still applies the option and returns true. Match that on PROFILE≥8.3; stay silent on the 8.2 reference profile. Co-authored-by: Cursor <cursoragent@cursor.com>
3 tasks
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
xml_parser_set_option($parser, $option, null)now emits Zend 8.3+/8.4E_WARNING(Argument #3 ($value) must be of type string|int|bool, null given) and still returnstrue/ applies the option (ext/xml/xml.cPHP_FUNCTION(xml_parser_set_option)).string|int|boolvalues (float, array, …) take the same warning path.string|int|boolpaths stay silent.PHP_COMPILER_PROFILEso Zend 8.2 stays silent.php-src:
ext/xml/xml.c(zpp"Olz"thenphp_error_docref(E_WARNING, …)thenzend_is_true/RETURN_TRUE). PHP implementation:ext/xml/xml_parser_set_option.php. No new C.Closes #30652
Test plan
PHP_COMPILER_PROFILE=8.4 php bin/vm.php test/repro/issue_30652_xml_parser_set_option_null.php→ Warning +truePHP_COMPILER_PROFILE=8.2 php bin/vm.php test/repro/issue_30652_xml_parser_set_option_null.php→true(silent)php -d memory_limit=512M vendor/bin/phpunit --filter XmlParserSetOptionNull30652Test→ OK 5/5php -d memory_limit=512M vendor/bin/phpunit --filter 'XmlModuleSkeletonTest|XmlParserSetOptionNull30652Test|XmlErrorStringNull30651Test'→ OK 18/18php script/bootstrap-inventory.php --check→OK 7386/7386XmlFunction::callstill VM-only)make bootstrap-selfhost-linkstill running at PR time — stale gen-0 Zend fallback (Trust: refresh gen-0 spine sidecar — stamp ≠ spine SHA; link falls back to Zend (prelinked/bootstrap-gen0) #28998); this change does not touch spine/gen-0Repro transcript (PROFILE=8.4)
Made with Cursor