id summary reporter owner description type status priority milestone component version severity resolution keywords cc focuses 5872 gettext fails to determine big-endian byteorder on 64bit systems tkoenig "Replying to comment by nyuwec for #3780 > So this code in the gettext.php (starting at line 105) works for me on both 32 and 64 bit systems: for I am generating the .mo-files on my PPC iBook, I end up with big-endian .mo-files. They are still not recognized correctly on my 64bit hosting platform. Thererfore the provided sourcecode is only half way there. I suggest adding another 64bit magic number. The following code should behave exactly as before except additionally working for big-endian .mo-files on 64bit architectures. I tested it and it worked well. {{{ // 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; // which is 0x959412de as s_int32 value // $MAGIC2 = (int)0xde120495; //bug $MAGIC2 = (int) - 569244523; // which is 0xde120495 as s_int32 value // 64-bit fix $MAGIC3 = (int) 2500072158; // which is 0x959412de as u_int32 value // 64-bit fix $MAGIC4 = (int) 3725722773; // which is 0xde120495 as u_int32 value $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 || $magic == $MAGIC4) { $this->BYTEORDER = 1; } else { $this->error = 1; // not MO file return false; } }}} " defect (bug) closed normal 2.8 I18N 2.3.3 normal fixed close gettext byteorder 64bit bigendian