[php-src] Issue #20008: undefined behavior in dom
| From: | chongwick | Date: | Tue, 30 Sep 2025 13:33:22 +0000 |
| Subject: | [php-src] Issue #20008: undefined behavior in dom | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-250951@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20008
Author: chongwick
### Description
The following code:
```php
<?php
$v_650 = '<p>foo</p>';
$v_651 = LIBXML_NOERROR;
$v_652 = DOM\HTMLDocument::createFromString($v_650,$v_651,);
$v_653 = $v_652->body;
$v_816 = new ReflectionClass($v_653,);
$v_817 = $v_816->newInstanceWithoutConstructor();
try{
$v_820 = var_dump($v_817,);
}
catch (Throwable $e){
$v_818 = $e->getMessage();
$v_819 = '\n';
}
```
Resulted in this output:
```
/home/w023dtc/nightly_php/php-src/ext/dom/token_list.c:254:7: runtime error: member access within
null pointer of type 'php_libxml_node_ptr' (aka 'struct _php_libxml_node_ptr')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/home/w023dtc/nightly_php/php-src/ext/dom/token_list.c:254:7
```
### PHP Version
```plain
nightly
```
### Operating System
ubuntu 22.04