fix phpb_e helper to accept null values
This commit is contained in:
@@ -7,13 +7,13 @@ if (! function_exists('phpb_e')) {
|
|||||||
/**
|
/**
|
||||||
* Encode HTML special characters in a string.
|
* Encode HTML special characters in a string.
|
||||||
*
|
*
|
||||||
* @param string $value
|
* @param string|null $value
|
||||||
* @param bool $doubleEncode
|
* @param bool $doubleEncode
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function phpb_e(string $value, bool $doubleEncode = true): string
|
function phpb_e(?string $value, bool $doubleEncode = true): string
|
||||||
{
|
{
|
||||||
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);
|
return htmlspecialchars($value ?? '', ENT_QUOTES, 'UTF-8', $doubleEncode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user