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

Bug #4167 Package unusable
Submitted: 2005-04-16 15:15 UTC Modified: 2006-12-27 00:16 UTC
From: joe at joestump dot net Assigned: jystewart
Status: Closed Package: Services_Technorati
PHP Version: Irrelevant OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2005-04-16 15:15 UTC] joe at joestump dot net
Description: ------------ After fixing the parse error I've already reported I'm getting the following problems in PHP5: Notice: Undefined variable: url in /usr/lib/php/Services/Technorati.php on line 410 Warning: array_merge() [function.array-merge]: Argument #2 is not an array in /usr/lib/php/Services/Technorati.php on line 410 Notice: Undefined variable: url in /usr/lib/php/Services/Technorati.php on line 417 Warning: join() [function.join]: Bad arguments. in /usr/lib/php/Services/Technorati.php on line 417 Notice: Undefined property: Services_Technorati::$_cache in /usr/lib/php/Services/Technorati.php on line 421 Fatal error: Call to a member function get() on a non-object in /usr/lib/php/Services/Technorati.php on line 421 Looking at the code I've found some things I find problematic: 1.) You use Services_Technorati::_checkOptions() in all of your functions (not bad), but you aren't checking the results of that function. Check out topTags() as an example. If the result of _checkOptions is a PEAR_Error shouldn't the function quit and return the error? 2.) You're using a variable called $url in the function which, as far as I can tell, is not defined anywhere in the function and you don't expect it as an option. What is this variable? Where does it come from? 3.) Your array_merge() call fails because you're attempting to merge a PEAR_Error and an array. 4.) You don't check to see if the person is using caching or not. Each call to $this->_cach->whatever() should be wrapped or prepended with if ($this->_cache !== false) or something like that. The biggest problem is the fact that you use this $url all over the place and it's not defined anywhere that I can find - that and the cache variable is called blindly.

Comments

 [2005-04-16 16:07 UTC] jystewart
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Services_Technorati THanks for the feedback. The topTags method was added with too much haste and I've cleaned it up a little. Also added return value checks for _checkOptions. Assistance with testing 0.5.6 would be much appreciated.