I have a weird behaviour here.
I have a snippet of code that I used to ran under zend framework 2 php (don't remember what version of it) and everything works like a charm.
For some reasons I'd changed this and run it under local PHP (5.3.25) as I started a new project over Symfony2, but I've took some snippet of code that could be useful for me.
However, now this code ins't working anymore:
$document = new \DOMDocument();
$document->loadXML($data);
$xpath = new \DOMXPath($document);
$xpath->registerNamespace('ns',"http://somenamespace.org/FOLDER/2013"); //casual ns used for this example
$foo = $xpath->query('//ns:AvailStatusMessage');
//some elaboration here
$barXPathString = $foo->getElementsByTagName('bar')->item(0)->getNodePath();
$foobar = $xpath->query($barXPathString .'/*[@fooBarAttribute="Available"]');
//some elaboration here
Result is that $foobar
is null (with previous version it wasn't). Obviously my code isn't changed. Although XML is important, this question ins't about "query correctness" (I know that is correct, because it worked into previous version) but about the following:
If I do: $this->logger->debug('X PATH STRING: '.$barXPathString);
result is
/OTA_HotelAvailGetRS/AvailStatusMessages/AvailStatusMessage/bar
but there isn't namespace. So i was wondering if between PHP version, this implementation is changed (don't know if this is issue maker, but I'm running crazy)
Is anyone aware of this?