Skip to content

Stdlib: SimpleXML methods/import excess argc → ArgumentCountError (#30828) - #30978

Merged
PurHur merged 2 commits into
masterfrom
agent/ext-dom-30828-simplexml-excess-argc
Aug 14, 2026
Merged

PurHur merged 2 commits into
masterfrom
agent/ext-dom-30828-simplexml-excess-argc

Conversation

@PurHur

@PurHur PurHur commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • SimpleXMLElement methods (children, attributes, xpath, registerXPathNamespace, addChild, addAttribute, getName, count, getNamespaces, getDocNamespaces, asXML/saveXML, __construct, __toString, hasChildren, getChildren) now throw Zend-shaped ArgumentCountError on excess user argc instead of silently accepting extra arguments.
  • Same for simplexml_load_string/simplexml_load_file (at most 5), simplexml_import_dom (at most 2), and dom_import_simplexml / Dom\import_simplexml (exactly 1).
  • JIT/AOT instance-method proxies emit a catchable ArgumentCountError (php-src-strict; php-src ext/simplexml/simplexml.stub.php + ext/dom/php_dom.stub.php).

Closes #30828

Test plan

  • Zend vs VM repro identical
  • ./script/phpunit.sh --filter SimpleXmlExcessArgc30828 — VM + JIT OK (2 tests)
  • php script/bootstrap-inventory.php --check — OK 7430/7430
  • php script/check-selfhost-spine-coverage-sync.php — OK
  • Existing SimpleXML legal-arity repros (maintainer_gap_simplexml_instance_methods, children_attributes, simplexml_load_string_basic) still exit 0

Verification

php test/repro/maintainer_gap_simplexml_excess_argc_30828.php
php bin/vm.php test/repro/maintainer_gap_simplexml_excess_argc_30828.php
# messages match Zend 8.2.32; legal path prints ok=r,3,r

./script/phpunit.sh --filter SimpleXmlExcessArgc30828
# OK (2 tests, 2 assertions)

Made with Cursor

PHP Compiler Ext — DOM & XML and others added 2 commits August 14, 2026 03:04
…0828)

Match php-src simplexml.stub.php / php_dom.stub.php: excess user args throw
ArgumentCountError instead of being silently accepted on VM and JIT/AOT.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit d1a47dd into master Aug 14, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the agent/ext-dom-30828-simplexml-excess-argc branch August 14, 2026 03:09
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: SimpleXML methods/import excess argc silently accepted — Zend ArgumentCountError (ext/simplexml/sxe.c)

1 participant