Revision 15:e200cb7efeb3 vendor/zendframework/zend-escaper/src/Escaper.php
| vendor/zendframework/zend-escaper/src/Escaper.php | ||
|---|---|---|
| 95 | 95 |
public function __construct($encoding = null) |
| 96 | 96 |
{
|
| 97 | 97 |
if ($encoding !== null) {
|
| 98 |
$encoding = (string) $encoding; |
|
| 98 |
if (! is_string($encoding)) {
|
|
| 99 |
throw new Exception\InvalidArgumentException( |
|
| 100 |
get_class($this) . ' constructor parameter must be a string, received ' . gettype($encoding) |
|
| 101 |
); |
|
| 102 |
} |
|
| 99 | 103 |
if ($encoding === '') {
|
| 100 | 104 |
throw new Exception\InvalidArgumentException( |
| 101 | 105 |
get_class($this) . ' constructor parameter does not allow a blank value' |
| ... | ... | |
| 103 | 107 |
} |
| 104 | 108 |
|
| 105 | 109 |
$encoding = strtolower($encoding); |
| 106 |
if (!in_array($encoding, $this->supportedEncodings)) {
|
|
| 110 |
if (! in_array($encoding, $this->supportedEncodings)) {
|
|
| 107 | 111 |
throw new Exception\InvalidArgumentException( |
| 108 | 112 |
'Value of \'' . $encoding . '\' passed to ' . get_class($this) |
| 109 | 113 |
. ' constructor parameter is invalid. Provide an encoding supported by htmlspecialchars()' |
| ... | ... | |
| 321 | 325 |
$result = $this->convertEncoding($string, 'UTF-8', $this->getEncoding()); |
| 322 | 326 |
} |
| 323 | 327 |
|
| 324 |
if (!$this->isUtf8($result)) {
|
|
| 328 |
if (! $this->isUtf8($result)) {
|
|
| 325 | 329 |
throw new Exception\RuntimeException( |
| 326 | 330 |
sprintf('String to be escaped was not valid UTF-8 or could not be converted: %s', $result)
|
| 327 | 331 |
); |
Also available in: Unified diff