|
| 1 | +--TEST-- |
| 2 | +GH-15868 (Assertion failure in xml_parse_into_struct after exception) |
| 3 | +--EXTENSIONS-- |
| 4 | +xml |
| 5 | +--FILE-- |
| 6 | +<?php |
| 7 | +$parser = xml_parser_create(); |
| 8 | +xml_set_element_handler($parser, |
| 9 | + function ($parser, $name, $attrs) { |
| 10 | + throw new Error('stop 1'); |
| 11 | + }, function ($parser, $name) { |
| 12 | + } |
| 13 | +); |
| 14 | +try { |
| 15 | + xml_parse_into_struct($parser, "<container/>", $values, $tags); |
| 16 | +} catch (Error $e) { |
| 17 | + echo $e->getMessage(), "\n"; |
| 18 | +} |
| 19 | + |
| 20 | +$parser = xml_parser_create(); |
| 21 | +xml_set_element_handler($parser, |
| 22 | + function ($parser, $name, $attrs) { |
| 23 | + }, function ($parser, $name) { |
| 24 | + throw new Error('stop 2'); |
| 25 | + } |
| 26 | +); |
| 27 | +try { |
| 28 | + xml_parse_into_struct($parser, "<container/>", $values, $tags); |
| 29 | +} catch (Error $e) { |
| 30 | + echo $e->getMessage(), "\n"; |
| 31 | +} |
| 32 | + |
| 33 | +$parser = xml_parser_create(); |
| 34 | +xml_set_character_data_handler($parser, function() { |
| 35 | + throw new Error('stop 3'); |
| 36 | +}); |
| 37 | +try { |
| 38 | + xml_parse_into_struct($parser, "<root><![CDATA[x]]></root>", $values, $tags); |
| 39 | +} catch (Error $e) { |
| 40 | + echo $e->getMessage(), "\n"; |
| 41 | +} |
| 42 | +?> |
| 43 | +--EXPECT-- |
| 44 | +stop 1 |
| 45 | +stop 2 |
| 46 | +stop 3 |
0 commit comments