mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-22 06:47:19 +00:00
Fix passing a null input to h function
Fix the following deprecation warning: Deprecated (8192): htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated [APP/Vendor/cakephp/cakephp/lib/Cake/basics.php, line 231]
This commit is contained in:
parent
219d13c0f0
commit
8473730ba2
2 changed files with 5 additions and 0 deletions
|
@ -243,6 +243,9 @@ class BasicsTest extends CakeTestCase {
|
|||
$obj = new CakeResponse(array('body' => 'Body content'));
|
||||
$result = h($obj);
|
||||
$this->assertEquals('Body content', $result);
|
||||
|
||||
$result = h(null);
|
||||
$this->assertEquals('', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -215,6 +215,8 @@ if (!function_exists('h')) {
|
|||
}
|
||||
} elseif (is_bool($text)) {
|
||||
return $text;
|
||||
} elseif (is_null($text)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
static $defaultCharset = false;
|
||||
|
|
Loading…
Reference in a new issue