@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 "strlen(null)" exceptions which block rendering page to import ICS calendar file

Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Closes T15362

Test Plan: Applied these two changes and `/calendar/import/edit/` correctly rendered the "Create Import" page in the web browser, with the expected error about the missing ICS file (instead of an exception stacktrace).

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15362

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

+2 -2
+1 -1
src/applications/calendar/import/PhabricatorCalendarICSFileImportEngine.php
··· 56 56 public function getDisplayName(PhabricatorCalendarImport $import) { 57 57 $filename_key = PhabricatorCalendarImportICSFileTransaction::PARAMKEY_NAME; 58 58 $filename = $import->getParameter($filename_key); 59 - if (strlen($filename)) { 59 + if (phutil_nonempty_string($filename)) { 60 60 return pht('ICS File "%s"', $filename); 61 61 } else { 62 62 return pht('ICS File');
+1 -1
src/applications/calendar/xaction/PhabricatorCalendarImportICSFileTransaction.php
··· 53 53 $new_value = $object->getParameter(self::PARAMKEY_FILE); 54 54 foreach ($xactions as $xaction) { 55 55 $new_value = $xaction->getNewValue(); 56 - if (!strlen($new_value)) { 56 + if (!phutil_nonempty_string($new_value)) { 57 57 continue; 58 58 } 59 59