Zend Framework

Gettext Adapter doesn´t work on (again)

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0.0
  • Fix Version/s: 1.0.1
  • Component/s: Zend_Translate
  • Labels:
    None

Description

When i use the Gettext Adapter on a 64bit machine with PHP 5.2.0 i get an error on importing the mo file...

After some research on the net ive found out, that it could be a bug in PHP itself and ive found a fix which looks something like this:

Gettext.php
// get Endian
        $input = $this->_readMOData(1);
        if (($input[1] == 2500072158) or ($input[1] == 18446744071914656478)) {
            $this->_bigEndian = false;
        } else if ($input[1] == 3725722773) {
            $this->_bigEndian = true;
        } else {
            throw new Zend_Translate_Exception('\'' . $filename . '\' is not a gettext file');
        }

this bug was already reported and fixed in 1.0.0 RC3 but looks like it has found its way back to final version.

Activity

Hide
Thomas Weidner added a comment -

Just because a fix for a bug of PHP itself works for one particular server does not automatically mean that it works for another.

As you stated the problem is through PHP itself which does not act as described within the documentation.
If the fix from 1428 would not have worked Julien would have mentioned this. So I am absolutly sure the problem is related to your installation and not all 64bit machines in sum.

Please give us:
PHP Version, OS, Processor, SVN Number of ZF
and the output of $input before the check.

Show
Thomas Weidner added a comment - Just because a fix for a bug of PHP itself works for one particular server does not automatically mean that it works for another. As you stated the problem is through PHP itself which does not act as described within the documentation. If the fix from 1428 would not have worked Julien would have mentioned this. So I am absolutly sure the problem is related to your installation and not all 64bit machines in sum. Please give us: PHP Version, OS, Processor, SVN Number of ZF and the output of $input before the check.
Hide
Bernhard Rosenberger added a comment -

PHP Version: 5.2.0
OS: openSuse 10.2
Processor: Intel Core2Duo E 6400
SVN Number: 2498

Output of $input:
Array ( [1] => 2500072158 )

Show
Bernhard Rosenberger added a comment - PHP Version: 5.2.0 OS: openSuse 10.2 Processor: Intel Core2Duo E 6400 SVN Number: 2498 Output of $input: Array ( [1] => 2500072158 )
Hide
Thomas Weidner added a comment -

Sorry, but if what you sent is true, you are using ZF 0.6...
Even if you switched the first two digits of the SVN number and meant 4298 you are using ZF 0.9.1 and not 1.0 !!!

Please update to the latest SVN or minimum to the version for which you were submitting your bug and report it again.

We are not supporting bug fixing for versions prior to 1.0 !!

Show
Thomas Weidner added a comment - Sorry, but if what you sent is true, you are using ZF 0.6... Even if you switched the first two digits of the SVN number and meant 4298 you are using ZF 0.9.1 and not 1.0 !!! Please update to the latest SVN or minimum to the version for which you were submitting your bug and report it again. We are not supporting bug fixing for versions prior to 1.0 !!
Hide
Bernhard Rosenberger added a comment -

sorry, looked on false location....

build is 5541

Show
Bernhard Rosenberger added a comment - sorry, looked on false location.... build is 5541
Hide
Thomas Weidner added a comment -

Then I ask you to change the following lines in gettext.php:

lines 97-99 new:

if (substr(dechex($input[1]), -8) == "950412de") {
            $this->_bigEndian = false;
        } else if (substr(dechex($input[1]), -8) == "de120495") {

and return us the results...
Should work but as we have no 64bit machine we can not verify it.

Show
Thomas Weidner added a comment - Then I ask you to change the following lines in gettext.php: lines 97-99 new:
if (substr(dechex($input[1]), -8) == "950412de") {
            $this->_bigEndian = false;
        } else if (substr(dechex($input[1]), -8) == "de120495") {
and return us the results... Should work but as we have no 64bit machine we can not verify it.
Hide
Bernhard Rosenberger added a comment -

yes, it works when i replace the lines.

but the fix is not in the current download archive (just downloaded it again to make sure).

Show
Bernhard Rosenberger added a comment - yes, it works when i replace the lines. but the fix is not in the current download archive (just downloaded it again to make sure).
Hide
Thomas Weidner added a comment -

How should the fix be in the download archive when
*) I just made the change
*) I have to be sure that it works before I commit it to public
*) I am not able to drive to the past and integrate it into 1.0 which has been released several weeks ago.

So it will be avaiable in the next SVN and downloadable by the next nightly snapshot and the next release (1.0.1).

Show
Thomas Weidner added a comment - How should the fix be in the download archive when *) I just made the change *) I have to be sure that it works before I commit it to public *) I am not able to drive to the past and integrate it into 1.0 which has been released several weeks ago. So it will be avaiable in the next SVN and downloadable by the next nightly snapshot and the next release (1.0.1).
Hide
Thomas Weidner added a comment -

Fixed as with SVN 5720

Show
Thomas Weidner added a comment - Fixed as with SVN 5720
Hide
Darby Felton added a comment -

Fixes 1.1.0

Show
Darby Felton added a comment - Fixes 1.1.0

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: