Skip to content

Regression: SimpleXMLElement::addChild/addAttribute(null) TypeError — Zend Deprecated + ValueError empty (ext/simplexml/sxe.c) #31554

Description

@PurHur

Category

Regression: · php-src-strict · SimpleXMLElement addChild/addAttribute null name

Problem

Passing null for $qualifiedName on Zend soft-deprecates null-to-string then throws ValueError: … Argument #1 ($qualifiedName) cannot be empty. VM hard-TypeErrors (must be of type string) with no deprecation.

Same soft-null class as open #31514 / #31530 (SimpleXMLElement ctor / xpath).

Probed 2026-08-16 — host Zend PHP 8.2.32 vs php bin/vm.php.

Repro Zend 8.2+ VM (2026-08-16)
$x->addChild(null) Deprecated + ValueError: … cannot be empty TypeError: … must be of type string
$x->addAttribute(null, 'v') Deprecated + ValueError: … cannot be empty TypeError: … must be of type string

php-src reference

PHP implementation target

  • ext/simplexml/SimpleXmlElementAddChild.php + SimpleXmlElementAddAttribute.php — under php-src-strict, soft-deprecate null then empty-name ValueError (reuse shared string-arg coerce helpers)
  • No new runtime/*.c

Repro

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_simplexml_addchild_addattribute_null.php'
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_simplexml_addchild_addattribute_null.php'

Done when

  • addChild(null) / addAttribute(null, …) emit Zend deprecation then ValueError: … cannot be empty
  • Targeted compliance/PHPUnit guard
  • php-src-strict; no php-compiler-strict shortcut

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions