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

Bug #9328 assigned by reference error in XML_RSS parse
Submitted: 2006-11-13 15:40 UTC Modified: 2008-09-16 11:06 UTC
From: mmclaughlin at newtier dot com Assigned: ashnazg
Status: Closed Package: XML_Parser
PHP Version: 4.4.4 OS: FreeBSD
Roadmaps: 1.3.2    
Subscription  


 [2006-11-13 15:40 UTC] mmclaughlin at newtier dot com (Mike McLaughlin)
Description: ------------ I wrote a script to gather an external RSS feed that I could use to show the user and have them select the articles of their choosing. If a RSS feed is used that does not exist I get a MESSAGE: Only variables should be assigned by reference. Test script: --------------- $url = 'www.rssfeednotexist.com'; $rss =& new XML_RSS($url); $error = $rss->parse(); Expected result: ---------------- Return an error back to my script which I could handle and display a message. Actual result: -------------- MESSAGE: Only variables should be assigned by reference TYPE: Notice FILE: /usr/local/www/data/mmclaughlin/flexreg/trunk/lib/pear/XML/Parser.php LINE: 479 DEBUG INFO: 474 } 475 } 476 // otherwise, $this->fp must be a string 477 } else { 478 if (!$this->_parseString($this->fp, true)) { 479 $error = &$this->raiseError(); 480 $this->free(); 481 return $error; 482 } 483 } 484 $this->free();

Comments

 [2006-11-13 18:42 UTC] mmclaughlin at newtier dot com
Adjusted from documentation package to XML_RSS package
 [2007-10-31 10:30 UTC] cweiske (Christian Weiske)
seems to be an xml_parser bug
 [2008-09-16 10:19 UTC] ashnazg (Chuck Burgess)
Duplicated this on PHP 4.4.9 on Ubuntu Hardy AMD64 Server, using XML_RSS-0.9.2 and XML_Parser-1.3.1, when E_NOTICE is enabled...
 [2008-09-16 10:20 UTC] ashnazg (Chuck Burgess)
The error does not occur on PHP5 (tested on 5.2.4) when E_NOTICE is enabled.
 [2008-09-16 11:06 UTC] ashnazg (Chuck Burgess)
Updating the method signature for raiseError() seems to solve this: < function raiseError($msg = null, $ecode = 0) --- > function &raiseError($msg = null, $ecode = 0) Add the reference operator so the method returns the reference. This fix tests fine in PHP 4.4.9 as well as PHP 5.2.4. Committed to CVS.