mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 08:12:40 +01:00
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
This commit is contained in:
parent
d4af32c1d4
commit
c0bc453405
1 changed files with 2 additions and 2 deletions
|
@ -48,11 +48,11 @@ final class PhabricatorCSVExportFormat
|
|||
// like it might be too tempting for Excel to ignore, mangle the value
|
||||
// to dissuade remote code execution. See T12800.
|
||||
|
||||
if (preg_match('/^\s*[+=@-]/', $value)) {
|
||||
if ($value && preg_match('/^\s*[+=@-]/', $value)) {
|
||||
$value = '(!) '.$value;
|
||||
}
|
||||
|
||||
if (preg_match('/\s|,|\"/', $value)) {
|
||||
if ($value && preg_match('/\s|,|\"/', $value)) {
|
||||
$value = str_replace('"', '""', $value);
|
||||
$value = '"'.$value.'"';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue