@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: Tests: Fix tests in PhabricatorEnvTestCase

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

According to https://web.archive.org/web/20171001040455/https://www.php.net/manual/en/language.types.array.php, `Null will be cast to the empty string, i.e. the key null will actually be stored under ""` at least since PHP 7.2, which we require.

Closes T16495

Test Plan: Run `../arcanist/bin/arc unit ./src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php` in PHP 8.5

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T16495

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

+14 -14
+14 -14
src/infrastructure/env/__tests__/PhabricatorEnvTestCase.php
··· 4 4 5 5 public function testLocalURIForLink() { 6 6 $map = array( 7 - '/' => true, 8 - '/D123' => true, 9 - '/path/to/something/' => true, 10 - "/path/to/\nHeader: x" => false, 11 - 'http://evil.com/' => false, 12 - '//evil.com/evil/' => false, 13 - 'javascript:lol' => false, 14 - '' => false, 15 - null => false, 16 - '/\\evil.com' => false, 7 + array('/', true), 8 + array('/D123', true), 9 + array('/path/to/something/', true), 10 + array("/path/to/\nHeader: x", false), 11 + array('http://evil.com/', false), 12 + array('//evil.com/evil/', false), 13 + array('javascript:lol', false), 14 + array(null, false), 15 + array('', false), 16 + array('/\\evil.com', false), 17 17 ); 18 18 19 - foreach ($map as $uri => $expect) { 19 + foreach ($map as $entry) { 20 20 $this->assertEqual( 21 - $expect, 22 - PhabricatorEnv::isValidLocalURIForLink($uri), 23 - pht('Valid local resource: %s', $uri)); 21 + $entry[1], 22 + PhabricatorEnv::isValidLocalURIForLink($entry[0]), 23 + pht('Valid local resource: %s', $entry[0])); 24 24 } 25 25 } 26 26