1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/xml/tests/bug30266.phpt
George Peter Banyard 0e5d654409 ext/xml: Refactor extension to use FCC instead of zvals for handlers (#12340)
To get proper errors and sensible behaviour, as the current behaviour is somewhat insane and part of it should be axed ASAP.

The behaviour is mostly intact with some minor BC breaks which are mentioned in UPGRADING.

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
2023-10-20 13:14:55 +01:00

52 lines
947 B
PHP

--TEST--
Bug #30266 (Invalid opcode 137/1/8)
--EXTENSIONS--
xml
--FILE--
<?php
/*
Currently (Feb 10, 2005) CVS HEAD fails with the following message:
Fatal error: Invalid opcode 137/1/8. in /home/hartmut/projects/php/dev/head/ext/xml/tests/bug30266.php on line 22
*/
class XML_Parser
{
public $dummy = "a";
function parse($data)
{
$parser = xml_parser_create();
xml_set_object($parser, $this);
xml_set_element_handler($parser, 'startHandler', 'endHandler');
xml_parse($parser, $data, true);
xml_parser_free($parser);
}
function startHandler($XmlParser, $tag, $attr)
{
$this->dummy = "b";
throw new Exception("ex");
}
function endHandler($XmlParser, $tag)
{
}
}
$p1 = new Xml_Parser();
try {
$p1->parse('<tag1><tag2></tag2></tag1>');
echo "Exception swallowed\n";
} catch (Exception $e) {
echo "OK\n";
}
?>
--EXPECT--
OK