@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix PHP 8.1 "preg_match(null)" exception exporting task list to CSV

Summary:
When a column value to export to CSV is empty, `null` is passed to `preg_match()` which is deprecated behavior since PHP 8.1.
Thus only call `preg_match()` when the value is set.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:51]
```

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:55]
```

Closes T15770

Test Plan: Export a Maniphest task list of query results to CSV.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15770

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

+2 -2
+2 -2
src/infrastructure/export/format/PhabricatorCSVExportFormat.php
··· 48 48 // like it might be too tempting for Excel to ignore, mangle the value 49 49 // to dissuade remote code execution. See T12800. 50 50 51 - if (preg_match('/^\s*[+=@-]/', $value)) { 51 + if ($value && preg_match('/^\s*[+=@-]/', $value)) { 52 52 $value = '(!) '.$value; 53 53 } 54 54 55 - if (preg_match('/\s|,|\"/', $value)) { 55 + if ($value && preg_match('/\s|,|\"/', $value)) { 56 56 $value = str_replace('"', '""', $value); 57 57 $value = '"'.$value.'"'; 58 58 }