PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Internationalization » Translation2 » Bug #8127

'0' isn't an empty string

Details

Submitted2006-07-06 08:56 UTC
Fromdan dot b at juno dot co dot uk
Assignedquipo
StatusNo Feedback
PackageTranslation2
PHP Version4.3.9
OSLinux 2.6.16-1.2108_FC4sm
Roadmaps(Not assigned)

Comments

[2006-07-06 08:56 UTC] dan dot b at juno dot co dot uk

Description:
------------
It you set up a string as the number zero (as you may well need to translate numbers to arabic), doing a get for this string brings back nothing. I'm guessing that the dreaded 'empty()' function is being used to test for blank strings, which the number 0 falls foul of, even though it's not an empty string.

Test script:
---------------
-- XML file --

<translation2>
<languages>
<lang id="en">
<name> english </name>
<meta> Some meta info here </meta>
<error_text> not available </error_text>
<encoding> iso-8859-1 </encoding>
</lang>
<pages>
<page key="test">
<string key="zero">
<tr lang="en"> 0 </tr>
</string>
</page>
</pages>
</translation2>

-- code --

$trans =& Translation2::factory('XML', array('filname' => 'test.xml'));
print "[" . $trans->get('zero', 'test') . "]";

Expected result:
----------------
Prints:

[0]

Actual result:
--------------
Prints:

[]

[2006-07-24 08:49 UTC] dan dot b at juno dot co dot uk

Sorry to open this one up again, but I've upgraded to Beta10 and the problem still exists.