Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed bug #14323: wrong / no error from setLang() [cwiedmann]

git-svn-id: http://svn.php.net/repository/pear/packages/Translation2/trunk@262860 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
commit 29fa5cde16512b8277d077ffe539b82b99018207 1 parent c69e359
Lorenzo Alberton quipo authored
Showing with 20 additions and 11 deletions.
  1. +10 −4 Container.php
  2. +2 −2 Decorator.php
  3. +3 −2 Translation2.php
  4. +5 −3 package.xml
14 Container.php
View
@@ -157,11 +157,14 @@ function setCharset($charset)
*
* @param string $langID language ID
*
- * @return array language information
+ * @return array|PEAR_Error language information
*/
function setLang($langID)
{
- $this->getLangs(); //load available languages, if not loaded yet (ignore return value)
+ $res = $this->getLangs(); //load available languages, if not loaded yet
+ if (PEAR::isError($res)) {
+ return $res;
+ }
if (!array_key_exists($langID, $this->langs)) {
return $this->raiseError('unknown language: "'.$langID.'"',
TRANSLATION2_ERROR_UNKNOWN_LANG,
@@ -212,13 +215,16 @@ function getLangData($langID, $format = 'id')
*
* @param string $format ['array' | 'ids' | 'names' | 'encodings']
*
- * @return array
+ * @return array|PEAR_Error
*/
function getLangs($format = 'array')
{
//if not cached yet, fetch langs data from the container
if (empty($this->langs) || !count($this->langs)) {
- $this->fetchLangs(); //container-specific method
+ $res = $this->fetchLangs(); //container-specific method
+ if (PEAR::isError($res)) {
+ return $res;
+ }
}
$tmp = array();
4 Decorator.php
View
@@ -198,11 +198,11 @@ function setCharset($charset)
*
* @param string $langID language ID
*
- * @return void
+ * @return true|PEAR_Error
*/
function setLang($langID)
{
- $this->translation2->setLang($langID);
+ return $this->translation2->setLang($langID);
}
// }}}
5 Translation2.php
View
@@ -296,7 +296,7 @@ function setCharset($charset)
*
* @param string $langID language code (for instance, 'en' or 'it')
*
- * @return void|PEAR_Error
+ * @return true|PEAR_Error
*/
function setLang($langID)
{
@@ -305,6 +305,7 @@ function setLang($langID)
return $res;
}
$this->lang = $res;
+ return true;
}
// }}}
@@ -373,7 +374,7 @@ function getLang($langID = null, $format = 'name')
*
* @param string $format ['ids', 'names', 'array']
*
- * @return array
+ * @return array|PEAR_Error
*/
function getLangs($format = 'name')
{
8 package.xml
View
@@ -45,8 +45,8 @@ Currently, the following decorators are provided:
<email>mike@php.net</email>
<active>yes</active>
</developer>
- <date>2008-05-18</date>
- <time>19:56:00</time>
+ <date>2008-07-17</date>
+ <time>12:20:00</time>
<version>
<release>2.0.1</release>
<api>2.0.1</api>
@@ -57,6 +57,7 @@ Currently, the following decorators are provided:
</stability>
<license uri="http://www.debian.org/misc/bsd.license">BSD</license>
<notes>- fixed bug #13933: undefined variable in the dataobjectsimple driver
+- fixed bug #14323: wrong / no error from setLang() [cwiedmann]
</notes>
<contents>
<dir name="/">
@@ -200,9 +201,10 @@ Currently, the following decorators are provided:
<release>stable</release>
<api>stable</api>
</stability>
- <date>2008-05-18</date>
+ <date>2008-07-17</date>
<license uri="http://www.debian.org/misc/bsd.license">BSD</license>
<notes>- fixed bug #13933: undefined variable in the dataobjectsimple driver
+- fixed bug #14323: wrong / no error from setLang() [cwiedmann]
</notes>
</release>
<release>
Please sign in to comment.
Something went wrong with that request. Please try again.