Skip to content

Stdlib: ext/xml — xml_parser_create / xml_parse_into_struct SAX API (ext/xml/xml.c parity) #3494

Description

@PurHur

Category

stdlib

Problem

ext/xml procedural API (xml_parser_create, xml_parse, xml_parser_free, xml_parse_into_struct, …) is unimplemented. Apps using SAX-style parsing (RSS, legacy integrations) cannot run. Distinct from DOM (#3326) and SimpleXML (#3338).

Prerequisite (bootstrap): land #7406 skeleton first so function_exists('xml_parser_create') is true and factories throw catchable stubs — avoid duplicating registration work in this issue.

php-src reference

Repro (failure today)

<?php
$p = xml_parser_create();
xml_parse($p, '<root/>', true);
xml_parser_free($p);
echo "ok\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php 2>&1 | head -3
'
Step Zend (ext/xml) VM today
function_exists('xml_parser_create') true false ❌
Parse simple fragment ok undefined function fatal ❌

Phase-1 slice (after #7406 skeleton):

<?php
$vals = [];
$idx  = [];
xml_parse_into_struct(xml_parser_create(), "<a><b/></a>", $vals, $idx);
var_export(array_key_exists('b', $idx));

Scope (this repo)

Path Work
ext/xml/ Real handlers (post-#7406 skeleton)
VM Parser resource type; incremental xml_parse; xml_error_string
ext/xml/xml_parse_into_struct.php Phase 1b struct builder
Tests test/compliance/cases/stdlib/xml_parse*.phpt
Matrix script/capability-matrix.php

PHP-in-PHP: parser state machine in ext/xml/*.php; expat via thin FFI if needed — not new logic in runtime/*.c. Libxml errors: #6058.

Done when

Verification

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

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