mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
Fix PHP 8.1 "preg_match(null)" exception which blocks rendering the "Browse Herald Rules" dialog
Summary: `preg_match()` does not accept passing null as the `$subject` string parameter in PHP 8.1. Thus first check that `$subject !== null`. ``` EXCEPTION: (RuntimeException) preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261] arcanist(head=master, ref.master=0e32dbc1ac8f), phorge(head=diffusionRepoPage, ref.master=5405134fa5db, ref.diffusionRepoPage=dbe5e3a68c41) #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261] #1 <#2> preg_match(string, NULL) called at [<phorge>/src/applications/herald/typeahead/HeraldRuleDatasource.php:25] ``` Closes T15422 Test Plan: Applied this change; afterwards on the "Diffusion 🡒 Push Logs 🡒 Advanced Search" page at `/diffusion/pushlog/?repositories=PHID-REPO-someRepositoryString`, clicking the search icon for the "Blocked By" field correctly renders.the "Browse Herald Rules" overlay dialog, listing available Herald rules. Reviewers: O1 Blessed Committers, valerio.bozzolan Reviewed By: O1 Blessed Committers, valerio.bozzolan Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno Maniphest Tasks: T15422 Differential Revision: https://we.phorge.it/D25248
This commit is contained in:
parent
e11c5486c9
commit
1dd9609bed
1 changed files with 1 additions and 1 deletions
|
@ -22,7 +22,7 @@ final class HeraldRuleDatasource
|
|||
$query = id(new HeraldRuleQuery())
|
||||
->setViewer($viewer);
|
||||
|
||||
if (preg_match('/^[hH]\d+\z/', $raw_query)) {
|
||||
if (($raw_query !== null) && preg_match('/^[hH]\d+\z/', $raw_query)) {
|
||||
$id = trim($raw_query, 'hH');
|
||||
$id = (int)$id;
|
||||
$query->withIDs(array($id));
|
||||
|
|
Loading…
Reference in a new issue