mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00

Setting the recovery option by using a hardcoded value (1) worked already for SimpleXML. For DOM, a small change is necessary because otherwise the recover field overwrites the recovery option. From a quick search on GitHub [1] it looks like this won't clash with existing PHP code as no one seems to define (or use) a constant with such a name. [1] https://github.com/search?q=LIBXML_RECOVER+language%3APHP&type=code&l=PHP
21 lines
434 B
PHP
21 lines
434 B
PHP
--TEST--
|
|
XML parsing with LIBXML_RECOVER
|
|
--EXTENSIONS--
|
|
simplexml
|
|
--FILE--
|
|
<?php
|
|
|
|
var_dump(simplexml_load_string('<root><child/>', options: LIBXML_RECOVER));
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: simplexml_load_string(): %s
|
|
|
|
Warning: simplexml_load_string(): <root><child/> in %s on line %d
|
|
|
|
Warning: simplexml_load_string(): ^ in %s on line %d
|
|
object(SimpleXMLElement)#1 (1) {
|
|
["child"]=>
|
|
object(SimpleXMLElement)#2 (0) {
|
|
}
|
|
}
|