Skip to content

Regression: SimpleXMLElement(null) TypeError — Zend Deprecated + Exception parse (ext/simplexml/sxe.c) #31514

Description

@PurHur

Category

Regression: · php-src-strict · SimpleXMLElement null data coercion

Problem

new SimpleXMLElement(null) on Zend soft-deprecates null-to-string then throws Exception: String could not be parsed as XML. VM rejects with TypeError: SimpleXMLElement::__construct(): Argument #1 ($data) must be of type string (no deprecation, no parse path).

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

Repro Zend 8.2+ VM (2026-08-16)
new SimpleXMLElement(null) Deprecated $data + Exception: String could not be parsed as XML TypeError: … Argument #1 ($data) must be of type string

php-src reference

PHP implementation target

  • ext/simplexml/ SimpleXMLElement ctor — soft-deprecate null→string under php-src-strict, then parse; throw Zend-shaped Exception on empty/invalid XML
  • No new runtime/*.c

Repro

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

Done when

  • new SimpleXMLElement(null) emits Zend deprecation then Exception: String could not be parsed as XML
  • 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