Skip to content

Stdlib: DOMDocumentFragment — createDocumentFragment/appendChild missing (ext/dom/php_dom.c, phase 2 #3326) #6317

Description

@PurHur

Category

stdlib · php-src-strict

Problem

DOMDocument::createDocumentFragment() and the DOMDocumentFragment class are missing (class_exists('DOMDocumentFragment') → false). Even after baseline #3326 (DOMDocument/DOMElement), workers need fragment nodes to batch-append subtrees without polluting the live document — standard in php-src ext/dom and required for config/HTML builders.

Depends on #3326 (DOMDocument baseline).

php-src reference

Repro (failure today)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(class_exists(\"DOMDocumentFragment\")); echo PHP_EOL;"
php -r "var_export(class_exists(\"DOMDocumentFragment\")); echo PHP_EOL;"
'
Check Zend (dom ext) VM
class_exists('DOMDocumentFragment') true false

After #3326 lands, minimal behavior repro:

<?php
$doc = new DOMDocument();
$frag = $doc->createDocumentFragment();
$child = $doc->createElement('item');
$frag->appendChild($child);
$doc->documentElement->appendChild($frag);
echo $doc->saveXML();

Scope (PHP-in-PHP first)

Layer Path
Classes ext/dom/BuiltinClasses.php — register DOMDocumentFragment
VM ext/dom/VmDom.php — fragment node type, appendChild delegation
Methods ext/dom/DocumentCreateDocumentFragment.php
Tests test/compliance/cases/stdlib/dom_document_fragment.phpt

Not in scope: full DOM Level 3 Load/Save (#3326 umbrella).

Done when

  • class_exists('DOMDocumentFragment') true on VM
  • createDocumentFragment() returns appendable fragment; subtree merges into document without extra wrapper element
  • appendChild on fragment moves children per php-src (not alias bugs)
  • ./script/ci-fast.sh --filter dom_document_fragment green

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter dom_document_fragment'

Related

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 machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions