@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Check if PhabricatorHash::digestForIndex() receives null

Summary:
Do not crash with an error passing down null by introducing a check.

```
ERROR 8192: sha1(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/hosts/__PHABRICATOR__/phabricator/src/infrastructure/util/PhabricatorHash.php:47]
```

Refs T16284

Test Plan: Somehow make `idx($_SERVER, 'REMOTE_ADDR')` return `null`, I guess.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16284

Differential Revision: https://we.phorge.it/D26458

+4 -1
+4 -1
src/infrastructure/util/PhabricatorHash.php
··· 39 39 * This method emphasizes compactness, and should not be used for security 40 40 * related hashing (for general purpose hashing, see @{method:digest}). 41 41 * 42 - * @param string $string Input string. 42 + * @param string|null $string Input string. 43 43 * @return string 12-byte, case-sensitive, mostly-alphanumeric hash of 44 44 * the string. 45 45 */ 46 46 public static function digestForIndex($string) { 47 + if ($string === null) { 48 + $string = ''; 49 + } 47 50 $hash = sha1($string, $raw_output = true); 48 51 49 52 static $map;