xref: /PHP-8.2/ext/xmlreader/tests/gh16292.phpt (revision 5c124939)
1--TEST--
2GH-16292 (Segmentation fault in ext/xmlreader/php_xmlreader.c:1282)
3--EXTENSIONS--
4dom
5xmlreader
6--FILE--
7<?php
8
9$character_data = new DOMCharacterData();
10$xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
11<books><book>new book</book></books>';
12$reader = new XMLReader();
13$reader->XML($xmlstring);
14while ($reader->read()) {
15    if ($reader->localName == "book") {
16        var_dump($reader->expand($character_data));
17    }
18}
19
20?>
21--EXPECTF--
22Warning: XMLReader::expand(): Couldn't fetch DOMCharacterData in %s on line %d
23bool(false)
24
25Warning: XMLReader::expand(): Couldn't fetch DOMCharacterData in %s on line %d
26bool(false)
27