Skip to content

Stdlib: SimpleXMLElement::xpath() invalid expression → warning + false (#22720)#22765

Merged
PurHur merged 3 commits into
masterfrom
fix/22720-simplexml-xpath-invalid-expression
Jul 24, 2026
Merged

Stdlib: SimpleXMLElement::xpath() invalid expression → warning + false (#22720)#22765
PurHur merged 3 commits into
masterfrom
fix/22720-simplexml-xpath-invalid-expression

Conversation

@PurHur

@PurHur PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Match php-src zim_simplexmlelement_xpath / xmlXPathEvalExpression failure: invalid XPath → E_WARNING SimpleXMLElement::xpath(): Invalid expression + false (not []).
  • Valid empty-result queries still return [].
  • User-script AOT: register SimpleXMLElement::xpath proxy; compile-time tree + literal path lower via host SimpleXML (false / empty node-set).

php-src: ext/simplexml/simplexml.c (sxe_xpath)
PHP impl: ext/simplexml/VmSimpleXml.php, JitSimpleXmlUserScript::tryXpath, JitSimpleXmlXpath
Closes #22720

Test plan

  • VM: php bin/vm.php test/repro/issue_22720_simplexml_xpath_invalid.php → warning + false / boolean; empty query → array
  • JIT: php bin/jit.php test/repro/issue_22720_simplexml_xpath_invalid.php (same)
  • AOT: php bin/compile.php -o /tmp/sxe22720 test/repro/issue_22720_simplexml_xpath_invalid_aot.php && /tmp/sxe22720 → warning + false / boolean / array:0
  • ./script/phpunit.sh --filter 'xpath_invalid_expression|xpath_child_and_absolute|xpath_register_namespace|xpath_live' → OK (8)
  • php script/bootstrap-inventory.php --check → OK 6505/6505
  • php script/check-selfhost-spine-coverage-sync.php → OK

Verification transcript (Docker)

=== AOT ===
PHP Warning:  SimpleXMLElement::xpath(): Invalid expression in  on line 0
false
boolean
array:0
EXIT:0
=== VM ===
PHP Warning:  SimpleXMLElement::xpath(): Invalid expression ...
false
boolean
array (
)
array

Made with Cursor

PurHur and others added 2 commits July 24, 2026 01:35
Gate GdExtensionPolicy on extension_loaded('gd') so Docker images without
php-gd no longer phantom-register gd_info/imagecreate (re-#11675 / #6215).

Co-authored-by: Cursor <cursoragent@cursor.com>
#22720)

Match php-src zim_simplexmlelement_xpath / xmlXPathEval failure: Invalid
expression E_WARNING and false (not empty array). Add user-script AOT
lowering for compile-time trees + literal paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 6f3be18 into master Jul 24, 2026
1 check failed
@PurHur
PurHur deleted the fix/22720-simplexml-xpath-invalid-expression branch July 24, 2026 10:03
@PurHur

PurHur commented Jul 24, 2026

Copy link
Copy Markdown
Owner Author

Cleanup bot: deleted leftover remote branch fix/22720-simplexml-xpath-invalid-expression (squash-merged here; #22720 closed; GD withhold commit also on master via #22757).

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.

Regression: SimpleXMLElement::xpath() invalid expression returns [] — Zend false + warning (ext/simplexml/sxe.c)

1 participant