Active
Project:
Amazon Store
Version:
6.x-2.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2011 at 20:37 UTC
Updated:
8 Jun 2011 at 20:50 UTC
On 32 bit systems, using intval() or (int) to cast a Browse Node ID to an integer value will cause problems on IDs > 2147483647.
if (!empty($get_BrowseNode)) {
$parameters['BrowseNode'] = intval($get_BrowseNode);
}
From the PHP docs:
The maximum value depends on the system. 32 bit systems have a maximum signed integer range of -2147483648 to 2147483647. So for example on such a system, intval('1000000000000') will return 2147483647. The maximum signed integer value for 64 bit systems is 9223372036854775807.
Max intval: 2147483647
Roller Hockey: 2345801011 (View on Amazon)
Overflow!
(This just bit me in the behind in my own Browse Node handling code, so it would be good to scour the code for anywhere that we convert the Browse Node IDs to integers.)
Comments
Comment #1
mcurry commentedYou'll know if you've experienced this problem if you see this kind of entry in your watchdog log:
Any BrowseNodeIds > 2147483647 are converted to 2147483647 by intval() or (int). So the system tries to retrieve this non-existent (invalid) id from Amazon.
Comment #2
mcurry commentedInteresting, in light of issue #1172474: Improve caching scheme (See description and comments for specific improvements), this can trigger repeated hits on Amazon's servers (which could trigger API throttling if you reference lots of IDs that overflow...