1--TEST-- 2Bug #52751 (XPath processing-instruction() function is not supported) 3--EXTENSIONS-- 4simplexml 5--FILE-- 6<?php 7 8$xml = <<<XML 9<?xml version="1.0" encoding="utf-8"?> 10<foo> 11 <bar>text node</bar> 12 <bar><?baz href="ftw" ?></bar> 13 <bar><?foo bar ?></bar> 14</foo> 15XML; 16 17$sxe = simplexml_load_string($xml); 18 19var_dump( 20 $sxe->xpath('//bar') 21); 22 23var_dump( 24 $sxe->xpath('//processing-instruction(\'baz\')') 25); 26 27foreach ($sxe->xpath('//processing-instruction()') as $pi) { 28 var_dump($pi->getName()); 29} 30 31?> 32--EXPECT-- 33array(3) { 34 [0]=> 35 object(SimpleXMLElement)#2 (1) { 36 [0]=> 37 string(9) "text node" 38 } 39 [1]=> 40 object(SimpleXMLElement)#3 (1) { 41 ["baz"]=> 42 object(SimpleXMLElement)#5 (0) { 43 } 44 } 45 [2]=> 46 object(SimpleXMLElement)#4 (1) { 47 ["foo"]=> 48 object(SimpleXMLElement)#5 (0) { 49 } 50 } 51} 52array(1) { 53 [0]=> 54 object(SimpleXMLElement)#4 (0) { 55 } 56} 57string(3) "baz" 58string(3) "foo" 59