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 #9529

Problem with Creator elements

Details

Request #9529Problem with Creator elements
Submitted2006-12-02 21:02 UTC
Frompeter dot melnikov at gmail dot com
Assignedttsuruoka
StatusClosed
PackageServices_Amazon
PHP Version4.4.4
OSWindows 2000 SP4
Roadmaps(Not assigned)

Comments

[2006-12-02 21:02 UTC] peter dot melnikov at gmail dot com

Description:
------------
I have just using AWS with PHP and got a problem with Creators attribute:

When there are at least two creators I get array of two elements (associative arrays):

[Creator] => Array(
[0] => Array ( [Role] => Editor [_content] => Stephen G. Kobourov)
[1] => Array( [Role] => Editor [_content] => Michael T. Goodrich )
)

But when an item has only one creator/editor, instead of array with the single element (array) I receive:

[Creator] => Array( [Role] => Editor [_content] => Joe Marks)

But I expecting:

[Creator] => Array( [0] => Array([Role] => Editor [_content]=>Joe Marks) )

In the same time dealing with Author goes correctly:

[Author] => Array([0] => Dimacs International Workshop)

Test script:
---------------
Here is the item you can test on (just enter valid access_key):

http://webservices.amazon.com/onca/xml?Service=AWSECommerceService&Version=2006-11-14&Operation=ItemLookup&AWSAccessKeyId=[ACCESS_KEY]&ItemId=3540420622&IdType=ASIN&ResponseGroup=Medium

<?php
require_once 'Services/AmazonECS4.php';

$amazon = new Services_AmazonECS4([ACCESS_KEY]);
$amazon->setCache('file', array('cache_dir' => 'cache/'));
$amazon->setCacheExpire(600); // 60 seconds = 1 min
$options = array();
$options['ResponseGroup'] = 'Medium';
$result = $amazon->ItemLookup('3540420622', $options);
print_r($result);
?>

Expected result:
----------------
[Author] => Array
(
[0] => M. Kaufmann
[1] => D. Wagner
)

[Binding] => Paperback
[Creator] => Array
(
[Role] => Editor
[_content] => Michael Kaufmann
)

Actual result:
--------------
[Author] => Array
(
[0] => M. Kaufmann
[1] => D. Wagner
)

[Binding] => Paperback
[Creator] => Array
( [0] => Array (
[Role] => Editor
[_content] => Michael Kaufmann
)
)

[2006-12-02 21:06 UTC] peter dot melnikov at gmail dot com

I placed actual and expected results in wrong sections. Expected result is specified in Actual result section and vice versa. Sorry.

[2006-12-03 06:48 UTC] ttsuruoka at php dot net

This has been fixed in CVS.
http://cvs.php.net/viewvc.cgi/pear/Services_Amazon/AmazonECS4.php?r1=1.4&r2=1.5

Thank you for reporting!