PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Internationalization » Translation2 » Bug #8128

getPage() does not work

Details

Submitted2006-07-06 09:08 UTC
Fromltiefland at gmail dot com
Assignedquipo
StatusClosed
PackageTranslation2
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2006-07-06 09:08 UTC] ltiefland at gmail dot com

Description:
------------
I'm using the DB driver for my project at http://fifa.lars-tiefland.de and wanted to make it multilingual using the Translation2 package. What I did NOT want was to fetch all the Strings seperately (it's too easy to forget to add new ones/delete old ones etc.), so I decided to use getPage() instead. But NOTHING was returned.

Test script:
---------------
<?
require_once("Translation2.php");
//code to generate a DB connection comes here
$params_tr["strings_default_table"]="i18n_%s";
$params_tr["string_text_col"]="string";
$tr=& Translation2::factory("db",$db,$params_tr);
$tr->setLang("de");
$tr->setPageID("common");
$page=$tr->getPage();
var_dump($page);
?>

fix for Translation2/Container/db.php, function getPage():

while($row=$res->fetchRow()) {
$key=$row["id"];
$value=$row["string"];
$strings["$key"]=$value;
}

Expected result:
----------------
An array of strings

Actual result:
--------------
array(1) {[""] => NULL}

[2006-07-06 09:37 UTC] ltiefland at gmail dot com

No, I have not tried the CVS version yet.

DB Dump for the language tables can be found at: http://fifa.lars-tiefland.de/i18n.sql.bz2

Tell me, if you also need the other tables.

BTW: I'm using MySQL 5.0, so it can be, that you get problems importing the SQL file, if you use an earlier version. If that's the case, please let me know which version you are using, so that I can choose the correct compability mode for the dump.

[2006-07-06 10:05 UTC] ltiefland at gmail dot com

I still get this behaviour. No returned strings with the CVS-Version either. What PHP/MySQL-combination are you using? Perhaps that's the reason, why it works for you and not for me. Could it also be a problem with the DB-Package (not MDB or MDB2)? Which version of the DB-package do you use? Or did you use MDB/MDB2?

[2006-07-06 10:09 UTC] ltiefland at gmail dot com

BTW: I use PHP4.4.2 with MySQL 5.0.22 and eAccelerator 0.9.5-beta2

[2006-07-06 10:15 UTC] ltiefland at gmail dot com

One more thing: On my computer at home I use PHP5.1.2 and get the same behaviour (will try CVS snapshot there as well).

[2006-07-06 10:27 UTC] ltiefland at gmail dot com

You can see the result with the original code at http://fifa.lars-tiefland.de

The right portion of the headline should read like this:

FIFA WC 2006 in Germany

But it reads as:

FIFA 2006 in

Did you accidently apply my patch, before reproducing the error? Your code would have to read like this, if unchanged:

while (list($key, $value) = $res->fetchRow()) {
$strings[$key] = $value;
}

I replaced it with

while($row=$res->fetchRow()) {
$key=$row["id"];
$value=$row["string"];
$strings["$key"]=$value;
}

and everything worked fine.

I've also tried to clean the temporary files of eAccellerator, but it did not help.

[2006-07-06 10:51 UTC] ltiefland at gmail dot com

That did the trick!

[2006-07-06 11:01 UTC] ltiefland at gmail dot com

I don't use MDB / MDB2, so I can't tell you (yet). I could test it this evening, when I'm back home. However, I think it will be best to apply the patch to those containers as well, just to be on the safe side.

Thanks for your help so far.