@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

Dashboard Panels: Fix PHP 8.1 "preg_match(null)" exception querying panels

Summary:
Passing null to `preg_match()` is deprecated since PHP 8.1.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php:31]
```

Closes T16421

Test Plan:
* PHP 8.1+
* Create a Dashboard at http://phorge.localhost/dashboard/
* Click "Add Existing Panel"
* In the "Add Panel" overlay click the magnifier button of the "Panel" input field

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16421

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

+1 -1
+1 -1
src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php
··· 28 28 $query = new PhabricatorDashboardPanelQuery(); 29 29 30 30 $raw_query = $this->getRawQuery(); 31 - if (preg_match('/^[wW]\d+\z/', $raw_query)) { 31 + if ($raw_query && preg_match('/^[wW]\d+\z/', $raw_query)) { 32 32 $id = trim($raw_query, 'wW'); 33 33 $id = (int)$id; 34 34 $query->withIDs(array($id));