Long integers as array keys are bugged on Linux 32bit

Bug #395713 reported by DJKRose on 2009-07-05
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

As described in http://bugs.php.net/bug.php?id=46701 there is a bug in php before version 5.3: On Linux 32 bit long integer array keys are not handled correctly. Here an example:

$test_array = array(
  0xcc5c4600 => 1,
  0xce331a00 => 1,
  0xce359000 => 1);

    [-2147483648] => 1

Long int array keys are used for the AoC protocol fix in AOChat.php:

define('RPC_TERRITORY_INIT', 0x9CB2CB03 );
RPC_TERRITORY_INIT => array("name"=>"Player Init", "args"=>"II"),

People, who are using the patch already, reported this problem here:

The problem results in not being able to connect to AoC at all, so it has high importance, if not critical.

DJKRose (dj-krose) on 2009-07-05
Changed in bebot:
assignee: nobody → DJKRose (dj-krose)
DJKRose (dj-krose) wrote :

There are two ways to solve this:
 - Raise the minimum requirements of BeBot to php 5.3
 - Write a workaround (i.e. an ugly hack), which looks like that:
   (string)RPC_UNIVERSE_INIT => array("name"=>"Login Init", "args"=>"SSI"),

I'm going to implement that workaround, because php 5.3 is fairly new and not widely used. But for the benefit of having clean code we shouldn't leave the workaround in the code too long, but think of raising the minimum php requiriments to 5.3 in a later version, maybe 0.7 or so... What do you think?

DJKRose (dj-krose) wrote :

Workaround added with rev 9 in (lp:~bebot-contrib/bebot/0.6.2-aocpatch)

Changed in bebot:
status: New → Fix Committed
Thomas Juberg (thomas-juberg) wrote :

I propose using the workaround code for now, but add a depreciated notice for PHP versions older than 5.3, as well as detecting PHP5.3 and not using the workaround code if we have a new enough version.

PHP 5.3 is barely one week old, but if there are other benefits to it, i don't see any reason why we cannot move to 5.3 req for trunk.

Changed in bebot:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers