Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.5

Bug #10499 object(AtomElement)'s xpath is NULL
Submitted: 2007-03-25 22:51 UTC
From: toydi Assigned: jystewart
Status: Closed Package: XML_Feed_Parser (version 1.0.1)
PHP Version: 5.1.6 OS: GNU/Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-03-25 22:51 UTC] toydi (Teo Hui Ming)
Description: ------------ The 'XML_Feed_Parser_AtomElement' class does not initiate its 'xpath' property in __contruct(). The patch below will probably fix the problem. Test script: --------------- $source = file_get_contents('atom10-entryonly.xml'); $feed = new XML_Feed_Parser($source); $entry = $feed->getEntryByOffset(0); // Output var_dump($entry->xpath); echo $entry->link(0, 'href', array('rel'=>'alternate')); Patch --------- diff -u Parser.org/AtomElement.php Parser/AtomElement.php --- Parser.org/AtomElement.php 2007-03-26 07:19:17.000000000 +0800 +++ Parser/AtomElement.php 2007-03-26 07:23:53.000000000 +0800 @@ -94,6 +94,8 @@ $this->parent = $parent; $this->xmlBase = $xmlBase; $this->xpathPrefix = "//atom:entry[atom:id='" . $this->id . "']/"; + + $this->xpath = $this->parent->xpath; } /** @@ -257,4 +259,4 @@ } } Expected result: ---------------- Output: object(DOMXPath)#5 (0) { } http://example.org/2005/04/02/atom Actual result: -------------- Output: NULL Fatal error: Call to a member function query() on a non-object in /usr/share/php/XML/Feed/Parser/Atom.php on line 338

Comments

 [2007-03-26 11:43 UTC] jystewart (James Stewart)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.