@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.

PHP 8.1: Do not pass null to ctype_digit() in AphrontFormDateControlValue::getStandardDateFormat()

Summary:
PHP 8.1 warns that `ctype_digit(): Argument of type null will be interpreted as string in the future`. Thus do not pass a `null` value to `ctype_digit()` in `AphrontFormDateControlValue` but check first that the value is not null.
```
ERROR 8192: ctype_digit(): Argument of type null will be interpreted as string in the future at [/var/www/html/phorge/phorge/src/view/form/control/AphrontFormDateControlValue.php:332]
```
(It does not matter if we `return null` or `return ''` as the new fallback of `getStandardDateFormat()` - Phorge seems to handle both in this case.)

Closes T15994

Test Plan:
1. Go to http://phorge.localhost/T1, select "Start Tracking Time", remove both values, click the "Start Timer" button
2. Go to http://phorge.localhost/phrequent/ and see that the task is listed
3. Go to http://phorge.localhost/T1, select "Stop Tracking Time", remove both values, click the "Stop Timer" button
4. Go to http://phorge.localhost/phrequent/ and see that the task is not listed
5. Use a non-standard task creation form via http://phorge.localhost/maniphest/task/edit/form/5/ which has custom date fields visible and editable defined via http://phorge.localhost/config/edit/maniphest.custom-field-definitions/, enable the date fields, and remove their values, and file the task. Same behavior as on git master without the patch: These custom date values get set on the newly created task (which is not what I'd expect but it's not a regression created by this patch).

Reviewers: O1 Blessed Committers, slip, valerio.bozzolan

Reviewed By: O1 Blessed Committers, slip, valerio.bozzolan

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

Maniphest Tasks: T15994

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

+4
+4
src/view/form/control/AphrontFormDateControlValue.php
··· 307 307 } 308 308 309 309 private function getStandardDateFormat($date) { 310 + // no value entered into the field at all 311 + if (!$date) { 312 + return null; 313 + } 310 314 $colloquial = array( 311 315 'newyear' => 'January 1', 312 316 'valentine' => 'February 14',