Skip to content

Regression: DOMElement::$prefix / $namespaceURI null on createElementNS nodes (ext/dom/node.c) #15381

Closed

Description

@PurHur

Category

stdlib · php-src-strict · DOM namespace node properties

Problem

DOMElement nodes created with createElementNS($namespace, $qualifiedName) must expose live prefix and namespaceURI properties. Zend returns ex and http://example.com/ns for createElementNS('http://example.com/ns', 'ex:a'). This compiler leaves both properties null.

Verified 2026-07-03 on master.

php-src reference

PHP implementation target

  • ext/dom/VmDom.php + DomNodeState — persist namespace URI + prefix when creating NS-qualified elements; expose via DOM object property reads (same path as nodeName / tagName)
  • PHP-in-PHP first in ext/dom/; shrink any duplicate C if present

Repro (verified 2026-07-03)

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_dom_element_ns_properties.php'      # Zend: ok
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_dom_element_ns_properties.php'  # fail exit 1

Repro: test/repro/maintainer_gap_dom_element_ns_properties.php

Runtime $el->prefix $el->namespaceURI
Zend ex http://example.com/ns
bin/vm.php null null

Done when

  • prefix / namespaceURI correct for createElementNS() elements (and update on rename if applicable per php-src)
  • Repro exits 0; compliance guard under test/compliance/cases/stdlib/dom_*

Related

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 3, 2026
  2. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    Related regression filed same run: #15380 (getAttributeNS/hasAttributeNS after setAttributeNS).

  3. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #15380, #15381, #15345)

  4. PurHur commented on Jul 3, 2026

    @PurHur
    OwnerAuthor

    Merged in #15394 — prefix/namespaceURI on createElementNS elements green; compliance guard added.

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 machineenhancementNew feature or requestimplementation-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