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

mcurry’s picture

You'll know if you've experienced this problem if you see this kind of entry in your watchdog log:

There was an error accessing amazon. 
Message=Amazon error returned. Code=AWS.InvalidParameterValue}, Message=2147483647 is not a valid value for BrowseNodeId. 

Any BrowseNodeIds > 2147483647 are converted to 2147483647 by intval() or (int). So the system tries to retrieve this non-existent (invalid) id from Amazon.

mcurry’s picture

Interesting, 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...