Skip to content

php-in-php: ext/libxml error buffer — LibXMLError without runtime/*.c (#6058) - #7698

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-libxml-6058
Jun 8, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-libxml-6058

Conversation

@PurHur

@PurHur PurHur commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/libxml/ module with libxml_use_internal_errors(), libxml_get_errors(), libxml_clear_errors(), and LibXMLError class — pure PHP ring buffer per php-src ext/libxml/libxml.c.
  • Wire xml_parse() malformed-input probe (ext/xml/VmXml.php) to record errors via VmLibxml::handleError() for DOM/SimpleXML loader integration later.
  • C shrink: 0 lines added to runtime/ or lib/AOT/runtime/; deleted unused ext/xml/XmlFunction.php stub (29 lines).

php-src reference

  • ext/libxml/libxml.c — internal error toggle + buffer
  • ext/libxml/libxml_error.c — LibXMLError object fields

PHP implementation

Layer Path
VM buffer ext/libxml/VmLibxml.php
Builtins ext/libxml/libxml_*.php
XML probe ext/xml/VmXml.php

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
echo function_exists(\"libxml_use_internal_errors\") ? \"yes\" : \"no\", PHP_EOL;
echo class_exists(\"LibXMLError\") ? \"yes\" : \"no\", PHP_EOL;
"'
# yes / yes

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit test/unit/LibxmlInternalErrorsTest.php'
# OK (4 tests, 15 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter libxml_internal_errors'
# OK (2 tests) — VM + JIT compliance

Closes #6058

Made with Cursor

Implement libxml_use_internal_errors/get_errors/clear_errors and LibXMLError without runtime/*.c growth; wire xml_parse() malformed-input probe to the buffer.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

php-in-php: libxml error buffer — libxml_use_internal_errors/get_errors/clear_errors without host libxml (ext/libxml)

1 participant