Edit: I have made a demo to my problem: http://codepad.org/ByNdAdCI
We use the following logic to set our arrays in 32 bit php:
private function formatAvailableOptions($availableOptions) {
$optionsAsArray = array();
foreach($availableOptions as $option){
$optionsAsArray[$option["entity_id"]] = $option["name"];
}
return $optionsAsArray;
}
Problem:
The
$option["entity_id"]
has grown too big to fit in 32 bit int, and as a result overflow when$optionsAsArray
gets created. For example$optionsAsArray[2147483648] = "hi";
becomes
$optionsAsArray[-2147483648] = "hi";
I need the index to be 2147483648 as it's tied to ids in the database
This code is already shipped to the client, and the logic is used in many places that makes it infeasible to modify every single instance to
$optionsAsArray[strVal(2147483648)] = "hi";
to make it run properly by using string type as key to associative array.
What is the best solution in this case? Is there a global config option for me to force all php arrays to use string as keys to get around this problem?