Changeset View
Changeset View
Standalone View
Standalone View
src/utils/utils.php
Show First 20 Lines • Show All 1,946 Lines • ▼ Show 20 Lines | function phutil_is_interactive() { | ||||
if (function_exists('posix_isatty') && posix_isatty(STDIN)) { | if (function_exists('posix_isatty') && posix_isatty(STDIN)) { | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
function phutil_encode_log($message) { | function phutil_encode_log($message) { | ||||
if (is_null($message)) { | |||||
return null; | |||||
} | |||||
speck: Doing some testing I think the behavior of `addcslashes()` when it's passed a null is to return… | |||||
return addcslashes($message, "\0..\37\\\177..\377"); | return addcslashes($message, "\0..\37\\\177..\377"); | ||||
} | } | ||||
/** | /** | ||||
* Insert a value in between each pair of elements in a list. | * Insert a value in between each pair of elements in a list. | ||||
* | * | ||||
* Keys in the input list are preserved. | * Keys in the input list are preserved. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 273 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0
Doing some testing I think the behavior of addcslashes() when it's passed a null is to return the empty string and not null. Looking at the callers of phutil_encode_log the return value is used in 2 different manners:
The .= appears to do the same thing with null as it does empty string, so this case doesn't seem to matter.
The other scenario where the result is used:
For which I'm not sure the behavior of pht() though I'd guess it'd be okay.