[wp-trac] Re: [WordPress Trac] #3780: gettext fails to determine
byteorder on 64bit systems with php5.2.1
WordPress Trac
wp-trac at lists.automattic.com
Thu Nov 15 09:05:35 GMT 2007
#3780: gettext fails to determine byteorder on 64bit systems with php5.2.1
---------------------------------------------+------------------------------
Reporter: abtime | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 2.4
Component: i18n | Version: 2.2
Severity: critical | Resolution:
Keywords: i18n has-patch 2nd-opition test |
---------------------------------------------+------------------------------
Comment (by nyuwec):
Replying to [comment:21 nbachiyski]:
> Could everybody, please, try the both patches and report if any is
working.
I have a gentoo linux on a 64 bit AMD processor, described in: #5356,
fighting with the above described problem. PHP using PHP_INT_SIZE=8.
Apply 3780.diff: FAILS.
Apply gettext-64-without-bitwise-ops.diff: WORKS!
As I can see the gettext-64-without-bitwise-ops.diff patches the gettext
to the format described in: http://wordpress.org/support/topic/63038 That
patch also works on both 64bit and on 32 bit systems I can test!
If only the 3780.diff applied to a 32 bit system it still works, applying
the gettext-64-without-bitwise-ops.diff: still works!
So this code in the gettext.php (starting at line 105) works for me on
both 32 and 64 bit systems:
{{{
// Caching can be turned off
$this->enable_cache = $enable_cache;
// $MAGIC1 = (int)0x950412de; //bug in PHP 5.0.2, see
https://savannah.nongnu.org/bugs/?func=detailitem&item_id=10565
$MAGIC1 = (int) - 1794895138;
// $MAGIC2 = (int)0xde120495; //bug
$MAGIC2 = (int) - 569244523;
// 64-bit fix
$MAGIC3 = (int) 2500072158;
$this->STREAM = $Reader;
$magic = $this->readint();
if ($magic == $MAGIC1 || $magic == $MAGIC3) { // to make
sure it works for 64-bit platforms
$this->BYTEORDER = 0;
} elseif ($magic == ($MAGIC2 & 0xFFFFFFFF)) {
$this->BYTEORDER = 1;
} else {
$this->error = 1; // not MO file
return false;
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/3780#comment:23>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list