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

Bug #12398 updateLang returns incorrect type
Submitted: 2007-11-07 20:15 UTC
From: sharedlog Assigned: quipo
Status: Closed Package: Translation2 (version 2.0.0RC1)
PHP Version: 5.2.0 OS: RHEL 4
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


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:
MUST BE VALID
Solve the problem : 32 + 47 = ?

 
 [2007-11-07 20:15 UTC] sharedlog (Dmitri Snytkine)
Description: ------------ According to package documentation the Translation2_Admin::updateLang() supposed to return true on success or PEAR_Error on failure. This is not the case with mdb2 driver because 'query' method in mdb2 does not return true on success, but instead returns an MDB2_Result handle The fix: in Admin/Container/mdb2.php find lines: $success = $this->db->query($query); $this->fetchLangs(); //update memory cache return $success; and replace with $success = $this->db->query($query); if (true != PEAR::isError($success)) { $success = true; } $this->fetchLangs(); //update memory cache return $success;

Comments

 [2007-11-07 23:17 UTC] cwiedmann (Carsten Wiedmann)
> This is not the case with mdb2 driver because 'query' > method in mdb2 I think, the real "bug" is: Why is $this->db->query() used (not only in this method)? UPDATE or INSERT are manipulation statements, thus $this->db->exec() should be used. > $success = $this->db->query($query); > $this->fetchLangs(); //update memory cache > return $success; Should be: | if (PEAR::isError($success = $this->db->exec($query))) { | return $success; | } | $this->fetchLangs(); //update memory cache | return (bool) $success; Regards, Carsten
 [2007-11-08 07:02 UTC] quipo (Lorenzo Alberton)
Yep, there's a mismatch between the docs and the actual behaviour, I'll fix it soon. Regarding the use of "query()" instead of "exec()", it's because "exec()" didn't exist at the time that Translation2 was written. I'll fix that too.
 [2007-11-09 21:04 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.