Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/constants/PhabricatorCookies.php
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | /* -( Next URI Cookie )---------------------------------------------------- */ | ||||
* @return list<string> List of timestamp and URI. | * @return list<string> List of timestamp and URI. | ||||
* | * | ||||
* @task next | * @task next | ||||
*/ | */ | ||||
private static function parseNextURICookie($cookie) { | private static function parseNextURICookie($cookie) { | ||||
// Old cookies look like: /uri | // Old cookies look like: /uri | ||||
// New cookies look like: timestamp,/uri | // New cookies look like: timestamp,/uri | ||||
if (!strlen($cookie)) { | if (!phutil_nonempty_string($cookie)) { | ||||
valerio.bozzolan: ✅ I logged this variable with `phlog()` to verify that `$cookie` just assumes values like null… | |||||
return null; | return null; | ||||
} | } | ||||
if (strpos($cookie, ',') !== false) { | if (strpos($cookie, ',') !== false) { | ||||
list($timestamp, $uri) = explode(',', $cookie, 2); | list($timestamp, $uri) = explode(',', $cookie, 2); | ||||
return array((int)$timestamp, $uri); | return array((int)$timestamp, $uri); | ||||
} | } | ||||
return array(0, $cookie); | return array(0, $cookie); | ||||
} | } | ||||
} | } |
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
✅ I logged this variable with phlog() to verify that $cookie just assumes values like null or strings like "1683107655,/" etc.
The function phutil_nonempty_string() will report any alien type, and that is OK.