mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

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>
33 lines
847 B
PHP
33 lines
847 B
PHP
--TEST--
|
|
Test XMLParser generic handlers as trampoline callback
|
|
--EXTENSIONS--
|
|
xml
|
|
--FILE--
|
|
<?php
|
|
class TrampolineTest {
|
|
public function __call(string $name, array $arguments) {
|
|
echo 'Trampoline for ', $name, PHP_EOL;
|
|
echo 'Target: ', $arguments[1], PHP_EOL;
|
|
echo 'Data: ', $arguments[2], PHP_EOL;
|
|
}
|
|
}
|
|
|
|
$o = new TrampolineTest();
|
|
$callback = [$o, 'pi_handler'];
|
|
|
|
$xml = <<<HERE
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
<?xml-stylesheet href="default.xsl" type="text/xml"?>
|
|
HERE;
|
|
|
|
/* Use xml_set_processing_instruction_handler() for generic implementation */
|
|
$parser = xml_parser_create();
|
|
xml_set_processing_instruction_handler($parser, $callback);
|
|
xml_parse($parser, $xml, true);
|
|
xml_parser_free($parser);
|
|
|
|
?>
|
|
--EXPECT--
|
|
Trampoline for pi_handler
|
|
Target: xml-stylesheet
|
|
Data: href="default.xsl" type="text/xml"
|