Category
Regression · php-src-strict · excess argc · ext/simplexml
Problem
Several SimpleXMLElement methods and SimpleXML procedural helpers silently accept excess arguments on VM. Zend throws ArgumentCountError. Same defect class as XMLWriter #30818 / DOM ChildNode #30814 / XMLReader #30641.
Probed 2026-08-13 — host Zend PHP 8.2.32 vs VM @ 9ea9b2ae8e.
| Repro |
Zend 8.2.32 |
VM |
$x->children(null, false, 1) |
ArgumentCountError: … at most 2 …, 3 given |
ACCEPTED (object) |
$x->attributes(null, false, 1) |
… at most 2 …, 3 given |
ACCEPTED |
$x->xpath('//a', 1) |
… exactly 1 …, 2 given |
ACCEPTED (array) |
$x->registerXPathNamespace('a','urn:a',1) |
… exactly 2 …, 3 given |
ACCEPTED |
$x->addChild('a','b',null,1) |
… at most 3 …, 4 given |
ACCEPTED |
$x->addAttribute('a','b',null,1) |
… at most 3 …, 4 given |
ACCEPTED |
dom_import_simplexml($x, 1) |
… exactly 1 …, 2 given |
ACCEPTED (DOMElement) |
simplexml_import_dom($d, null, 1) |
… at most 2 …, 3 given |
ACCEPTED |
simplexml_load_string('<r/>', 'SimpleXMLElement', 0, '', false, 1) |
… at most 5 …, 6 given |
ACCEPTED |
php-src reference
PHP implementation target
ext/simplexml/SimpleXmlElementChildren.php, SimpleXmlElementAttributes.php, SimpleXmlElementXpath.php, SimpleXmlElementRegisterXPathNamespace.php, SimpleXmlElementAddChild.php, SimpleXmlElementAddAttribute.php
ext/simplexml/simplexml_load_string.php, simplexml_import_dom.php, + dom_import_simplexml bridge
- Shared Zend-shaped argc guard (not
LogicException); JIT call helpers under lib/JIT/Call/SimpleXMLElement* if invoke skips VM objects
Repro
./script/docker-exec.sh -- bash -lc 'php -r '\''$x=simplexml_load_string("<r><a/></r>"); try { $x->children(null,false,1); echo "ACCEPTED\n"; } catch (Throwable $e) { echo $e->getMessage(),"\n"; }'\'''
./script/docker-exec.sh -- bash -lc 'php bin/vm.php -r '\''$x=simplexml_load_string("<r><a/></r>"); try { $x->children(null,false,1); echo "ACCEPTED\n"; } catch (Throwable $e) { echo $e->getMessage(),"\n"; }'\'''
Done when
Category
Regression· php-src-strict · excess argc · ext/simplexmlProblem
Several
SimpleXMLElementmethods and SimpleXML procedural helpers silently accept excess arguments on VM. Zend throwsArgumentCountError. Same defect class as XMLWriter #30818 / DOM ChildNode #30814 / XMLReader #30641.Probed 2026-08-13 — host Zend PHP 8.2.32 vs VM @
9ea9b2ae8e.$x->children(null, false, 1)ArgumentCountError: … at most 2 …, 3 givenACCEPTED(object)$x->attributes(null, false, 1)… at most 2 …, 3 givenACCEPTED$x->xpath('//a', 1)… exactly 1 …, 2 givenACCEPTED(array)$x->registerXPathNamespace('a','urn:a',1)… exactly 2 …, 3 givenACCEPTED$x->addChild('a','b',null,1)… at most 3 …, 4 givenACCEPTED$x->addAttribute('a','b',null,1)… at most 3 …, 4 givenACCEPTEDdom_import_simplexml($x, 1)… exactly 1 …, 2 givenACCEPTED(DOMElement)simplexml_import_dom($d, null, 1)… at most 2 …, 3 givenACCEPTEDsimplexml_load_string('<r/>', 'SimpleXMLElement', 0, '', false, 1)… at most 5 …, 6 givenACCEPTEDphp-src reference
ext/simplexml/sxe.cext/simplexml/simplexml.cext/simplexml/simplexml.stub.phpPHP implementation target
ext/simplexml/SimpleXmlElementChildren.php,SimpleXmlElementAttributes.php,SimpleXmlElementXpath.php,SimpleXmlElementRegisterXPathNamespace.php,SimpleXmlElementAddChild.php,SimpleXmlElementAddAttribute.phpext/simplexml/simplexml_load_string.php,simplexml_import_dom.php, +dom_import_simplexmlbridgeLogicException); JIT call helpers underlib/JIT/Call/SimpleXMLElement*if invoke skips VM objectsRepro
Done when
ArgumentCountErrorfor the probed methods/helpers (and siblings with fixed arity)test/repro/+ smallest compliance VM/JIT pair