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

Bug #6605 reference to NULL element
Submitted: 2006-01-27 14:30 UTC
From: renzo dot toma at xs4all dot nl Assigned: ttsuruoka
Status: Closed Package: Services_Amazon
PHP Version: 5.0.4 OS: linux/fedoracore4
Roadmaps: (Not assigned)    
Subscription  


 [2006-01-27 14:30 UTC] renzo dot toma at xs4all dot nl
Description: ------------ PHP Notice: Undefined index: TotalResults in /usr/share/pear/Services/Amazon.php on line 796 Can easilly be fixed with an: if (isset($data['TotalResults'])) { $totalresults = $data['TotalResults']; } else { $totalresults = ''; } Did Amazon change the XML structure? Test script: --------------- #!/usr/bin/php <?php if ($argc != 2) { print "Usage: $argv[0] <asin>\n"; die; } $asin = $argv[1]; require_once 'PEAR.php'; require_once 'Services/Amazon.php'; $amazon = &new Services_Amazon('...', 'dev'); $products = $amazon->searchAsin($asin); if(!PEAR::isError($products)) { if (isset($products[0])) { $product = $products[0]; $authors = implode(', ', $product['authors']); echo "{$product['name']}, {$authors}, {$product{'asin'}}, {$product['imagesmall']}, {$product['url']}"; } } else { echo $products->message; } ?> Expected result: ---------------- No PHP notice Actual result: -------------- PHP Notice: Undefined index: TotalResults in /usr/share/pear/Services/Amazon.php on line 796

Comments

 [2006-01-27 16:53 UTC] ttsuruoka at php dot net
This bug has been fixed in CVS. Thank you for reporting!