Browse Source

ZF-11906: Fix some array to string conversion errors for PHP 5.4 compatibility

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24807 44c647ce-9c0f-0410-b52a-842ac1e357ba
adamlundrigan 13 years ago
parent
commit
c3c8931d36

+ 1 - 1
library/Zend/Cache/Core.php

@@ -211,7 +211,7 @@ class Zend_Cache_Core
     public function setOption($name, $value)
     {
         if (!is_string($name)) {
-            Zend_Cache::throwException("Incorrect option name : $name");
+            Zend_Cache::throwException("Incorrect option name!");
         }
         $name = strtolower($name);
         if (array_key_exists($name, $this->_options)) {

+ 8 - 2
library/Zend/Config/Yaml.php

@@ -201,7 +201,10 @@ class Zend_Config_Yaml extends Zend_Config
             foreach ($section as $sectionName) {
                 if (!isset($config[$sectionName])) {
                     require_once 'Zend/Config/Exception.php';
-                    throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
+                    throw new Zend_Config_Exception(sprintf(
+                        'Section "%s" cannot be found', 
+                        implode(' ', (array)$section)
+                    ));
                 }
 
                 $dataArray = array_merge($this->_processExtends($config, $sectionName), $dataArray);
@@ -210,7 +213,10 @@ class Zend_Config_Yaml extends Zend_Config
         } else {
             if (!isset($config[$section])) {
                 require_once 'Zend/Config/Exception.php';
-                throw new Zend_Config_Exception(sprintf('Section "%s" cannot be found', $section));
+                throw new Zend_Config_Exception(sprintf(
+                    'Section "%s" cannot be found', 
+                    implode(' ', (array)$section)
+                ));
             }
 
             $dataArray = $this->_processExtends($config, $section);

+ 4 - 3
library/Zend/Json/Server/Response.php

@@ -144,13 +144,14 @@ class Zend_Json_Server_Response
      */
     public function setVersion($version)
     {
-        $version = (string) $version;
-        if ('2.0' == $version) {
+        $version = is_array($version)
+            ? implode(' ', $version)
+            : $version;
+        if ((string)$version == '2.0') {
             $this->_version = '2.0';
         } else {
             $this->_version = null;
         }
-
         return $this;
     }
 

+ 4 - 2
library/Zend/Locale/Format.php

@@ -99,8 +99,9 @@ class Zend_Locale_Format
                         $options['number_format'] = Zend_Locale_Data::getContent($locale, 'decimalnumber');
                     } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
                         require_once 'Zend/Locale/Exception.php';
+                        $stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
                         throw new Zend_Locale_Exception("Unknown number format type '" . gettype($value) . "'. "
-                            . "Format '$value' must be a valid number format string.");
+                            . "Format '$stringValue' must be a valid number format string.");
                     }
                     break;
 
@@ -113,8 +114,9 @@ class Zend_Locale_Format
                         $options['date_format'] = Zend_Locale_Format::getDateFormat($locale);
                     } else if ((gettype($value) !== 'string') and ($value !== NULL)) {
                         require_once 'Zend/Locale/Exception.php';
+                        $stringValue = (string)(is_array($value) ? implode(' ', $value) : $value);
                         throw new Zend_Locale_Exception("Unknown dateformat type '" . gettype($value) . "'. "
-                            . "Format '$value' must be a valid ISO or PHP date format string.");
+                            . "Format '$stringValue' must be a valid ISO or PHP date format string.");
                     } else {
                         if (((isset($options['format_type']) === true) and ($options['format_type'] == 'php')) or
                             ((isset($options['format_type']) === false) and (self::$_options['format_type'] == 'php'))) {

+ 1 - 1
library/Zend/Validate/Abstract.php

@@ -239,7 +239,7 @@ abstract class Zend_Validate_Abstract implements Zend_Validate_Interface
 
         $message = str_replace('%value%', (string) $value, $message);
         foreach ($this->_messageVariables as $ident => $property) {
-            $message = str_replace("%$ident%", (string) $this->$property, $message);
+            $message = str_replace("%$ident%", implode(' ',(array)$this->$property), $message);
         }
 
         $length = self::getMessageLength();