mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
Fix PHP 8.1 "strlen(null)" exceptions which block rendering the DarkConsole
Summary: Since PHP 8.1 the function call `strlen(null)` is deprecated. Since Phabricator/Phorge elevates deprecation warnings to exceptions, the specific fix implies dealing with null, and dealing with real strings. In the specific case, a simple cast was made to deal with real strings. Closes T15315 Test Plan: Visit the Home Page with DarkConsole enabled in your configuration: no crashes Reviewers: O1 Blessed Committers, avivey Reviewed By: O1 Blessed Committers, avivey Subscribers: aklapper, speck, tobiaswiese, Matthew, Cigaryno Maniphest Tasks: T15315 Differential Revision: https://we.phorge.it/D25165
This commit is contained in:
parent
524dc83b4e
commit
c1c7699c98
1 changed files with 3 additions and 0 deletions
|
@ -124,6 +124,9 @@ final class DarkConsoleCore extends Phobject {
|
||||||
} else if (is_resource($data)) {
|
} else if (is_resource($data)) {
|
||||||
return '<resource>';
|
return '<resource>';
|
||||||
} else {
|
} else {
|
||||||
|
// This is very probably not a string in strict sense
|
||||||
|
$data = phutil_string_cast($data);
|
||||||
|
|
||||||
// Truncate huge strings. Since the data doesn't really matter much,
|
// Truncate huge strings. Since the data doesn't really matter much,
|
||||||
// just truncate bytes to avoid PhutilUTF8StringTruncator overhead.
|
// just truncate bytes to avoid PhutilUTF8StringTruncator overhead.
|
||||||
$length = strlen($data);
|
$length = strlen($data);
|
||||||
|
|
Loading…
Reference in a new issue