Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.4

Bug #14323 wrong / no error from setLang()
Submitted: 2008-07-10 16:16 UTC
From: cwiedmann Assigned: quipo
Status: Closed Package: Translation2 (version 2.0.0)
PHP Version: 5.2.6 OS: Windows_NT
Roadmaps: (Not assigned)    
Subscription  


 [2008-07-10 16:16 UTC] cwiedmann (Carsten Wiedmann)
Description: ------------ Hello, three problems with setLang(): a) If you are using a decorator, Translation2_Decorator::setLang() does not return the return value from Translation2::setLang(). b) If there is a problem with e.g. the database connection, the returned error is "unknown language" and not the real database problem. c) Translation2::setLang() can return a PEAR_Error object, so it should return otherwise true instead of void (PEAR coding standard) Regards, Carsten Test script: --------------- <?php $mdb2 =& MDB2::singleton('mysqli://root:wrong@localhost/foo'); //try with and without a wrong passoword $tr =& Translation2::factory('MDB2', $mdb2); //$tr =& $tr->getDecorator('Lang'); //try with and without this line $res = $tr->setLang('foo'); //lang doesn't exists in db var_dump($res); ?> Expected result: ---------------- a) with or without a decorator, it should return a database or "unknown language" error b) if all is ok, true should be returned Actual result: -------------- a) with a decorator, no error is returned b) without a decorator, allways a "unknown language" error is returned (even if there is a problem with the database connection)

Comments

 [2008-07-17 11:21 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.