summaryrefslogtreecommitdiff
path: root/ext/simplexml/tests/bug45553.phpt
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2008-09-10 11:20:35 +0000
committerRob Richards <rrichards@php.net>2008-09-10 11:20:35 +0000
commit9068c264bedd081107863d4efa59042c763d86ee (patch)
treeb5d7afc91d22585af986cf16bf0fad59446476fe /ext/simplexml/tests/bug45553.phpt
parentafa54750202367daa9102583ecb8170df3fcd9da (diff)
downloadphp-git-9068c264bedd081107863d4efa59042c763d86ee.tar.gz
fix bug #45553 (Using XPath for attributes with a namespace does not work)
add test
Diffstat (limited to 'ext/simplexml/tests/bug45553.phpt')
-rw-r--r--ext/simplexml/tests/bug45553.phpt31
1 files changed, 31 insertions, 0 deletions
diff --git a/ext/simplexml/tests/bug45553.phpt b/ext/simplexml/tests/bug45553.phpt
new file mode 100644
index 0000000000..37a46f4276
--- /dev/null
+++ b/ext/simplexml/tests/bug45553.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Bug #45553 (Using XPath to return values for attributes with a namespace does not work)
+--FILE--
+<?php
+$xml =<<<XML
+<xml xmlns:a="http://a">
+ <data a:label="I am A" label="I am Nothing">test1</data>
+ <a:data a:label="I am a:A" label="I am a:Nothing">test2</a:data>
+</xml>
+XML;
+
+$x = simplexml_load_string($xml);
+$x->registerXPathNamespace("a", "http://a");
+
+$atts = $x->xpath("/xml/data/@a:label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/a:data");
+echo $atts[0]->attributes() . "\n";
+$atts = $x->xpath("/xml/a:data/@a:label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/a:data/@label");
+echo $atts[0] . "\n";
+$atts = $x->xpath("/xml/data/@label");
+echo $atts[0] . "\n";
+?>
+--EXPECTF--
+I am A
+I am a:Nothing
+I am a:A
+I am a:Nothing
+I am Nothing \ No newline at end of file