@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.5: Fix null array key listing Files without author

Summary:
Setting null as an array key is deprecated since PHP 8.5 per https://www.php.net/releases/8.5/en.php: "Using null as an array offset or when calling array_key_exists() is now deprecated. Use an empty string instead."

Looked into the phid array to spot a null value; followed up the callstack to find where it comes from and fix the root cause.

```
ERROR 8192: Using null as an array offset is deprecated, use an empty string instead at [/var/www/html/phorge/phorge/src/applications/phid/query/PhabricatorObjectQuery.php:132]
#0 PhabricatorObjectQuery::loadObjectsByPHID(array, array) called at [<phorge>/src/applications/phid/query/PhabricatorObjectQuery.php:73]
[...]
#10 PhabricatorApplicationSearchEngine::buildResponse() called at [<phorge>/src/applications/files/controller/PhabricatorFileListController.php:16]
```

Closes T16529

Test Plan:
* PHP 8.5
* Have some files that recently got automagically created (like user avatars, or maybe also transforms)
* Go to http://phorge.localhost/file/query/all/ and make sure "Upload Source" says "(Show All)"

Reviewers: O1 Blessed Committers, mainframe98

Reviewed By: O1 Blessed Committers, mainframe98

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

Maniphest Tasks: T16529

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

+3 -1
+3 -1
src/applications/files/query/PhabricatorFileSearchEngine.php
··· 127 127 protected function getRequiredHandlePHIDsForResultList( 128 128 array $files, 129 129 PhabricatorSavedQuery $query) { 130 - return mpull($files, 'getAuthorPHID'); 130 + 131 + // Remove non-manually created files which do not have an author 132 + return mpull(mfilter($files, 'getAuthorPHID'), 'getAuthorPHID'); 131 133 } 132 134 133 135 /**