@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 projects used without a PHID set in unit test

Summary:
`PhabricatorProjectCoreTestCase` creates projects that it doesn't save to the database. As a result, they don't have a PHID. This causes issues because `::getPHID()` will return null instead, which in PHP 8.5 results in deprecation warnings.

Closes T16496

Test Plan:
Run this unit test on PHP 8.5 and see no 'ERROR 8192' anymore:

arc unit src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php

Alternatively, for those in the stone age, add a null check to `PhabricatorProjectMembersPolicyRule` for `$object->getPHID()` on lines 34 & 70. (It's me, I'm in the stone age)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16496

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

+11 -3
+11 -3
src/applications/project/__tests__/PhabricatorProjectCoreTestCase.php
··· 496 496 $user2 = $this->createUser(); 497 497 $user2->save(); 498 498 499 - $project = PhabricatorProject::initializeNewProject($user1); 499 + $project = PhabricatorProject::initializeNewProject($user1) 500 + ->setName(pht('Test Project for %s', __FUNCTION__)) 501 + ->save(); 502 + 500 503 $name = pht('Test Project %d', mt_rand()); 501 504 502 505 $xactions = array(); ··· 596 599 $slug2 = 'QuErYSlUgExTrA'; 597 600 598 601 $project = PhabricatorProject::initializeNewProject($user); 602 + $project->setPHID($project->generatePHID()); 599 603 600 604 $xactions = array(); 601 605 ··· 1184 1188 $author = $this->generateNewTestUser(); 1185 1189 1186 1190 $proj_a = PhabricatorProject::initializeNewProject($author) 1187 - ->setName('Policy A') 1191 + ->setName('Policy A'); 1192 + $proj_a->setPHID($proj_a->generatePHID()) 1188 1193 ->save(); 1194 + 1189 1195 $proj_b = PhabricatorProject::initializeNewProject($author) 1190 - ->setName('Policy B') 1196 + ->setName('Policy B'); 1197 + $proj_b->setPHID($proj_b->generatePHID()) 1191 1198 ->save(); 1192 1199 1193 1200 $user_none = $this->generateNewTestUser(); ··· 1671 1678 $is_milestone = false) { 1672 1679 1673 1680 $project = PhabricatorProject::initializeNewProject($user, $parent); 1681 + $project->setPHID($project->generatePHID()); 1674 1682 1675 1683 $name = pht('Test Project %d', mt_rand()); 1676 1684