1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

PHP 8.1 "preg_match(null)" exception in javelin/markup.php when http_action not set

Summary:
Accessing a project's workboard URL of a non-existing workboard shows RunTimeException in PHP 8.1:

    preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated

Closes T15262

Test Plan: Page whether to create a workboard for a project was displayed after this change

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

Reviewed By: O1 Blessed Committers, avivey, valerio.bozzolan

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

Maniphest Tasks: T15262

Differential Revision: https://we.phorge.it/D25131
This commit is contained in:
Andre Klapper 2023-04-25 15:44:39 +02:00
parent 98c1267e5f
commit 935d7120ee
2 changed files with 5 additions and 2 deletions

View file

@ -448,7 +448,7 @@ final class AphrontRequest extends Phobject {
}
private function getPrefixedCookieName($name) {
if (strlen($this->cookiePrefix)) {
if (phutil_nonempty_string($this->cookiePrefix)) {
return $this->cookiePrefix.'_'.$name;
} else {
return $name;

View file

@ -77,7 +77,10 @@ function phabricator_form(PhabricatorUser $user, $attributes, $content) {
$is_post = (strcasecmp($http_method, 'POST') === 0);
$http_action = idx($attributes, 'action');
$is_absolute_uri = preg_match('#^(https?:|//)#', $http_action);
$is_absolute_uri = 0;
if (phutil_nonempty_string($http_action)) {
$is_absolute_uri = preg_match('#^(https?:|//)#', $http_action);
}
if ($is_post) {