64-bit host compatibility for hash function in pure-PHP implementation of CDB reader...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 24 Jul 2009 22:15:23 +0000 (22:15 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 24 Jul 2009 22:15:23 +0000 (22:15 +0000)
commitedb3e4582571973d04c473bf163055901995f894
tree193021e9d4a829f427b820b333ccf1cb14572387
parent48851dc4221294f449da9796e009cecb4b36cb4e
64-bit host compatibility for hash function in pure-PHP implementation of CDB reader/writer.
This fixes the problem where localization cache files generated under command-line and web were incompatible on Mac OS X when using $wgCacheDirectory instead of l10n_cache table in database.
(Apple ships a 64-bit Apache+mod_php but only a 32-bit CLI php binary, and neither has the cda extension present by default.)

Confirmed hash compatibility with native cda extension by running Tim's maintenance/cdb-test.php on 32-bit and 64-bit Ubuntu installs:

32 bit before patch:
brion@bribuntu:~/src/phase3$ php maintenance/cdb-test.php
Write test...
e5d9cbbcd0137b281da400bb213820fa  php.cdb
e5d9cbbcd0137b281da400bb213820fa  dba.cdb
Read test...
Done.

32-bit after patch:
brion@bribuntu:~/src/phase3$ php maintenance/cdb-test.php
Write test...
84108f6dab5c34823333169ca05eb5c3  php.cdb
84108f6dab5c34823333169ca05eb5c3  dba.cdb
Read test...
Done.
brion@bribuntu:~/src/phase3$

64-bit before patch:
brion@bribuntu64:~/src/phase3$ php maintenance/cdb-test.php
Write test...
188d06832d321b20e88e9d0200242efc  php.cdb
14e0225466464003d21496204f12d20c  dba.cdb <- note mismatch!
Read test...
Done.

64-bit after patch:
brion@bribuntu64:~/src/phase3$ php maintenance/cdb-test.php
Write test...
d244a877c9639e27c79aa1bdbcaee3c2  php.cdb
d244a877c9639e27c79aa1bdbcaee3c2  dba.cdb <- now matches!
Read test...
Done.

YESSSS
includes/Cdb_PHP.php