PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Web Services » Services_Amazon » Bug #8182

I retreaved a wrong PEAR::raiseError ?

Details

Submitted2006-07-11 16:41 UTC
Fromono_matope at hotmail dot com
Assignedttsuruoka
StatusClosed
PackageServices_Amazon
PHP Version4.4.2
OSWindows XP SP2
Roadmaps(Not assigned)

Comments

[2006-07-11 16:41 UTC] ono_matope at hotmail dot com

Description:
------------
Hi.
I used BrowseNodeLookup or ItemLookup via doBatch, And I retrieved a warning and PHP::raiseError object.

I think the _checkContentError always returns PEAR::raiseError object when doBatch is called.

If it is a kind of a bug, would you fix it?

When I changed a few lines in the code of _checkContentError() like below, It goes fine.
=====================
if(0!=count($errors)){ <-- Added
$this->_errors = $errors;
return PEAR::raiseError(implode(':', $this->getError()));
} <-- Added
=====================

Test script:
---------------
$this->amazon = new Services_AmazonECS4 ([id],[affiliate id]);
$this->amazon->setLocale('JP');
$shared = array('ResponseGroup' =>'BrowseNodeInfo');
$params1 = array('BrowseNodeId' => "513256");
$params2 = array('BrowseNodeId' => "513256");
$result = $this->amazon->doBatch('BrowseNodeLookup', $shared, $params1, $params2);
print_r ($result);

Expected result:
----------------
Array ( [0] => Array ( [Request] => Array ( [IsValid] => True [BrowseNodeLookupRequest] => Array ( [BrowseNodeId] => 507300 [ResponseGroup] => Array ( [0] => BrowseNodeInfo ) ) ) [BrowseNode] => Array ( [BrowseNodeId] => 507300 [Name] => SF・ホラー・ファンタジー [Children] => Array ( [BrowseNode] => Array ( [0] => Array ( [BrowseNodeId] => 507304 [Name] => 日本の著者 ) [1] => Array ( [BrowseNodeId] => 507054 [Name] => 外国の著者 ) ) ) ) ) [1] => Array ( [Request] => Array ( [IsValid] => True [BrowseNodeLookupRequest] => Array ( [BrowseNodeId] => 513256 [ResponseGroup] => Array ( [0] => BrowseNodeInfo ) ) ) [BrowseNode] => Array ( [BrowseNodeId] => 513256 [Name] => 日本の著者 [Children] => Array ( [BrowseNode] => Array ( [0] => Array ( [BrowseNodeId] => 513260 [Name] => あ行 ) [1] => Array ( [BrowseNodeId] => 513262 [Name] => か行 ) [2] => Array ( [BrowseNodeId] => 513264 [Name] => さ行 ) [3] => Array ( [BrowseNodeId] => 513266 [Name] => た行 ) [4] => Array ( [BrowseNodeId] => 513268 [Name] => な行 ) [5] => Array ( [BrowseNodeId] => 513270 [Name] => は行 ) [6] => Array ( [BrowseNodeId] => 513272 [Name] => ま行 ) [7] => Array ( [BrowseNodeId] => 546492 [Name] => や行 ) [8] => Array ( [BrowseNodeId] => 513274 [Name] => ら・わ行 ) ) ) ) )

Actual result:
--------------
Warning: implode(): Bad arguments. in C:\Program Files\php\pear\Services\AmazonECS4.php on line 1071
pear_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => [message] => [userinfo] => [backtrace] => Array ( [0] => Array ( [file] => C:\Program Files\php\pear\PEAR.php [line] => 543 [function] => pear_error [class] => pear_error [type] => -> [args] => Array ( [0] => [1] => [2] => 1 [3] => 1024 [4] => ) ) [1] => Array ( [file] => C:\Program Files\php\pear\Services\AmazonECS4.php [line] => 1071 [function] => raiseerror [class] => pear [type] => :: [args] => Array ( [0] => ) ) [2] => Array ( [file] => C:\Program Files\php\pear\Services\AmazonECS4.php [line] => 1040 [function] => _checkcontenterror [class] => services_amazonecs4 [type] => -> [args] => Array ( [0] => Array ( [0] => Array ( [Request] => Array ( [IsValid] => True [BrowseNodeLookupRequest] => Array ( [BrowseNodeId] => 507300 [ResponseGroup] => Array ( [0] => BrowseNodeInfo ) ) ) [BrowseNode] => Array ( [BrowseNodeId] => 507300 [Name] => SF・ホラー・ファンタジー [Children] => Array ( [BrowseNode] => Array ( [0] => Array ( [BrowseNodeId] => 507304 [Name] => 日本の著者 ) [1] => Array ( [BrowseNodeId] => 507054 [Name] => 外国の著者 ) ) ) ) ) [1] => Array ( [Request] => Array ( [IsValid] => True [BrowseNodeLookupRequest] => Array ( [BrowseNodeId] => 513256 [ResponseGroup] => Array ( [0] => BrowseNodeInfo ) ) ) [BrowseNode] => Array ( [BrowseNodeId] => 513256 [Name] => 日本の著者 [Children] => Array ( [BrowseNode] => Array ( [0] => Array ( [BrowseNodeId] => 513260 [Name] => あ行 ) [1] => Array ( [BrowseNodeId] => 513262 [Name] => か行 ) [2] => Array ( [BrowseNodeId] => 513264 [Name] => さ行 ) [3] => Array ( [BrowseNodeId] => 513266 [Name] => た行 ) [4] => Array ( [BrowseNodeId] => 513268 [Name] => な行 ) [5] => Array ( [BrowseNodeId] => 513270 [Name] => は行 ) [6] => Array ( [BrowseNodeId] => 513272 [Name] => ま行 ) [7] => Array ( [BrowseNodeId] => 546492 [Name] => や行 ) [8] => Array ( [BrowseNodeId] => 513274 [Name] => ら・わ行 ) ) ) ) ) ) ) ) [3] => Array ( [file] => C:\Program Files\php\pear\Services\AmazonECS4.php [line] => 857 [function] => _sendrequest [class] => services_amazonecs4 [type] => -> [args] => Array ( [0] => Array ( [Operation] => BrowseNodeLookup [BrowseNodeLookup.Shared.ResponseGroup] => BrowseNodeInfo [BrowseNodeLookup.1.BrowseNodeId] => 507300 [BrowseNodeLookup.2.BrowseNodeId] => 513256 ) ) ) [4] => Array ( [file] => C:\Program Files\Apache Group\Apache2\htdocs\sample\amazon\build_bn_class.php [line] => 19 [function] => dobatch [class] => services_amazonecs4 [type] => -> [args] => Array ( [0] => BrowseNodeLookup [1] => Array ( [ResponseGroup] => BrowseNodeInfo ) [2] => Array ( [BrowseNodeId] => 507300 ) [3] => Array ( [BrowseNodeId] => 513256 ) ) ) [5] => Array ( [file] => C:\Program Files\Apache Group\Apache2\htdocs\sample\amazon\build_bn_class.php [line] => 25 [function] => build_bn [class] => build_bn_class [type] => -> [args] => Array ( [0] => 507300 ) ) ) [callback] => )

[2006-08-04 13:59 UTC] ttsuruoka at php dot net

This has been fixed in the latest releasaed version.

Thank you for reporting!

[2006-08-09 06:09 UTC] ono_matope at hotmail dot com

Thank you for your fixing! :)