1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Make src/infrastructure/javelin/markup.php phabricator_form PHP 8.1 compliant

Summary:
src/infrastructure/javelin/markup.php phabricator_form() performs a strcasecmp() operation on an optional attribute withoiut checking to see if it exists first. This causes an 'Passing null to parameter #1 ($string1) of type string is deprecated' error.

Because we subsequenly check to see that the value equals /POST/i, all we need to do is check that the value has some 'true' value before doing the strcasecmp(). If it's not true, then it won't be POST!

Fixes T15509

Test Plan: View a diff. Eg: https://my.phorge.site/D1234

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15509

Differential Revision: https://we.phorge.it/D25319
This commit is contained in:
Steve Campbell 2023-06-30 14:34:41 +01:00
parent 101ce834b8
commit 73253489bf

View file

@ -74,7 +74,7 @@ function phabricator_form(PhabricatorUser $user, $attributes, $content) {
$body = array();
$http_method = idx($attributes, 'method');
$is_post = (strcasecmp($http_method, 'POST') === 0);
$is_post = $http_method && (strcasecmp($http_method, 'POST') === 0);
$http_action = idx($attributes, 'action');