Category
php-in-php | stdlib
Problem
DOM/SimpleXML loaders (#3337, #3338) need libxml_use_internal_errors(), libxml_get_errors(), and libxml_clear_errors() to capture parse failures instead of emitting warnings. These are undefined on bin/vm.php today, forcing host libxml calls or silent parse failures during self-host.
php-src registers them in ext/libxml — not scattered C in runtime/.
php-src reference
Repro
./script/docker-exec.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;
'
Observed: both no
Zend PHP expected: both yes; invalid XML returns errors array when internal errors enabled.
Scope (this repo)
Done when
libxml_use_internal_errors(true) suppresses warnings; libxml_get_errors() returns LibXMLError[] for malformed XML load attempt
libxml_clear_errors() empties buffer
- Self-host probe:
class_exists('LibXMLError') true without Zend PHP in loop
test/compliance/cases/stdlib/libxml_internal_errors.phpt green on VM
./script/docker-exec.sh -- vendor/bin/phpunit --filter LibxmlInternalErrors
Links
Category
php-in-php|stdlibProblem
DOM/SimpleXML loaders (#3337, #3338) need
libxml_use_internal_errors(),libxml_get_errors(), andlibxml_clear_errors()to capture parse failures instead of emitting warnings. These are undefined onbin/vm.phptoday, forcing hostlibxmlcalls or silent parse failures during self-host.php-src registers them in ext/libxml — not scattered C in
runtime/.php-src reference
ext/libxml/libxml.c—PHP_FUNCTION(libxml_use_internal_errors),libxml_get_errors,libxml_clear_errorsext/libxml/libxml_error.c—LibXMLErrorobjectRepro
Observed: both
noZend PHP expected: both
yes; invalid XML returns errors array when internal errors enabled.Scope (this repo)
ext/libxml/module skeleton (mirror Bootstrap: ext/filter/ module skeleton — register filter_var/filter_list for self-host (M4) #5839 filter skeleton / Bootstrap: ext/intl/ module skeleton — register intl classes for self-host (M4) #5774 intl skeleton)LibXMLErrorclass; optional thin FFI to host libxml only for bootstrap until native parser landslibxml_set_streams_context()later under same moduleruntime/libxml_*.ctables — behavior inext/libxml/*.phpDone when
libxml_use_internal_errors(true)suppresses warnings;libxml_get_errors()returnsLibXMLError[]for malformed XML load attemptlibxml_clear_errors()empties bufferclass_exists('LibXMLError')true without Zend PHP in looptest/compliance/cases/stdlib/libxml_internal_errors.phptgreen on VM./script/docker-exec.sh -- vendor/bin/phpunit --filter LibxmlInternalErrorsLinks