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)    

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 29 + 30 = ?

 [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)


 [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 by the end of next Sunday (CET). If this was a problem with the 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.