1--TEST-- 2Test XMLParser generic handlers as trampoline callback 3--EXTENSIONS-- 4xml 5--FILE-- 6<?php 7class TrampolineTest { 8 public function __call(string $name, array $arguments) { 9 echo 'Trampoline for ', $name, PHP_EOL; 10 echo 'Target: ', $arguments[1], PHP_EOL; 11 echo 'Data: ', $arguments[2], PHP_EOL; 12 } 13} 14 15$o = new TrampolineTest(); 16$callback = [$o, 'pi_handler']; 17 18$xml = <<<HERE 19<?xml version="1.0" encoding="ISO-8859-1"?> 20<?xml-stylesheet href="default.xsl" type="text/xml"?> 21HERE; 22 23/* Use xml_set_processing_instruction_handler() for generic implementation */ 24$parser = xml_parser_create(); 25xml_set_processing_instruction_handler($parser, $callback); 26xml_parse($parser, $xml, true); 27xml_parser_free($parser); 28 29?> 30--EXPECT-- 31Trampoline for pi_handler 32Target: xml-stylesheet 33Data: href="default.xsl" type="text/xml" 34