diff vendor/zendframework/zend-escaper/src/Escaper.php @ 2:5311817fb629

Theme updates
author Chris Cannam
date Tue, 10 Jul 2018 13:19:18 +0000
parents c75dbcec494b
children
line wrap: on
line diff
--- a/vendor/zendframework/zend-escaper/src/Escaper.php	Thu Jul 05 15:32:06 2018 +0100
+++ b/vendor/zendframework/zend-escaper/src/Escaper.php	Tue Jul 10 13:19:18 2018 +0000
@@ -95,7 +95,11 @@
     public function __construct($encoding = null)
     {
         if ($encoding !== null) {
-            $encoding = (string) $encoding;
+            if (! is_string($encoding)) {
+                throw new Exception\InvalidArgumentException(
+                    get_class($this) . ' constructor parameter must be a string, received ' . gettype($encoding)
+                );
+            }
             if ($encoding === '') {
                 throw new Exception\InvalidArgumentException(
                     get_class($this) . ' constructor parameter does not allow a blank value'
@@ -103,7 +107,7 @@
             }
 
             $encoding = strtolower($encoding);
-            if (!in_array($encoding, $this->supportedEncodings)) {
+            if (! in_array($encoding, $this->supportedEncodings)) {
                 throw new Exception\InvalidArgumentException(
                     'Value of \'' . $encoding . '\' passed to ' . get_class($this)
                     . ' constructor parameter is invalid. Provide an encoding supported by htmlspecialchars()'
@@ -321,7 +325,7 @@
             $result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding());
         }
 
-        if (!$this->isUtf8($result)) {
+        if (! $this->isUtf8($result)) {
             throw new Exception\RuntimeException(
                 sprintf('String to be escaped was not valid UTF-8 or could not be converted: %s', $result)
             );