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 #2629

Translation2_Admin::removeLang() does nothing (with db container)

Details

Submitted2004-10-27 13:35 UTC
Fromylf at xung dot org
Assignedquipo
StatusClosed
PackageTranslation2
PHP Version4.3.4
OSLinux Debian
Roadmaps(Not assigned)

Comments

[2004-10-27 13:35 UTC] ylf at xung dot org

Description:
------------
The summary says it all. See reproduce code for more.

Reproduce code:
---------------
<?php

error_reporting (E_ALL);

require_once 'PEAR.php';
require_once 'DB.php';
require_once 'Translation2/Admin.php';

$dsn = '...';
$db =& DB::connect($dsn);

// Starting with an empty db : tables langs and i18n do not exist

$db->query('drop table if exists langs, i18n');

$tr =& Translation2_Admin::factory('DB', $db);

if (PEAR::isError($tr)) exit($tr->getMessage());

$newLang = array(
'lang_id' => 'en',
'table_name' => 'i18n',
'name' => 'english',
'meta' => 'some meta info',
'error_text' => 'not available');

$tr->createNewLang($newLang);

$newLang = array(
'lang_id' => 'fr',
'table_name' => 'i18n',
'name' => 'french',
'meta' => 'some meta info',
'error_text' => 'not available');

$tr->createNewLang($newLang);

$tr->add('someString','somePage',array('en' => 'Some string within some page',
'fr' => 'Du texte sur une page'));

// The following does nothing
$tr->removeLang('en');

// And this neither :
$tr->removeLang('en',true);

echo "<html><body><pre>";

echo "----------------------------------------\n";
echo "table : langs\n";
echo "----------------------------------------\n";

$res =& $db->getAll("select * from langs",array(),DB_FETCHMODE_ASSOC);
print_r ($res);

echo "\n\n----------------------------------------\n";
echo "table : i18n\n";
echo "----------------------------------------\n";
$res =& $db->getAll("select * from i18n",array(),DB_FETCHMODE_ASSOC);
print_r ($res);

echo "</pre></body></html>";
?>

Expected result:
----------------
----------------------------------------
table : langs
----------------------------------------
Array
(
[0] => Array
(
[id] => fr
[name] => french
[meta] => some meta info
[error_text] => not available
)

)

----------------------------------------
table : i18n
----------------------------------------
Array
(
[0] => Array
(
[page_id] => somePage
[id] => someString
[fr] => Du texte sur une page
)

)

Actual result:
--------------
----------------------------------------
table : langs
----------------------------------------
Array
(
[0] => Array
(
[id] => en
[name] => english
[meta] => some meta info
[error_text] => not available
)

[1] => Array
(
[id] => fr
[name] => french
[meta] => some meta info
[error_text] => not available
)

)

----------------------------------------
table : i18n
----------------------------------------
Array
(
[0] => Array
(
[page_id] => somePage
[id] => someString
[en] => Some string within some page
[fr] => Du texte sur une page
)

)