Page MenuHomePhorge

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

Authored by aklapper on Apr 22 2023, 07:37.

Details

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

Diff Detail

Repository
rP Phorge
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Garr, this includes D25130. I am not a huge fan of arc's "commit everything or nothing" though I did use arc diff --create already.

Garr, this includes D25130. I am not a huge fan of arc's "commit everything or nothing" though I did use arc diff --create already.

You can use arc diff --base HEAD~ to only take one commit for the revision.

This revision is now accepted and ready to land.Apr 22 2023, 08:36

sgtm

src/aphront/AphrontRequest.php
451

Thanks. This fix for PHP 8.1 should be very OK since the default is NULL and nothing alien (like false) should arrive causing the related crash from the phutil check.

If an alien value will arrive causing a crash, we can just discuss that specific case again.

451

Thanks. This fix for PHP 8.1 should be very OK since the default is NULL and nothing alien (like false) should arrive causing the related crash from the phutil check.

If an alien value will arrive causing a crash, we can just discuss that specific case again.

src/infrastructure/javelin/markup.php
83

Thanks. This fix for PHP 8.1 should be very OK since the default is NULL and nothing alien (like false) should arrive causing the related crash from the phutil check.

If an alien value will arrive causing a crash, we can just discuss that specific case again.

Since preg_match returns zero for zero matches, this seems the most appropriate fix to me.

src/infrastructure/javelin/markup.php
84