@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) error in PhabricatorFile::newChunkedFile()

Summary:
Fix PHP 8.1 strlen(null) error in PhabricatorFile::newChunkedFile().

Fixes T15499

Test Plan:
Added a unit test which replicated the fault, so you can test simply by 'arc unit'
Alternatively, see test in T15499

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15499

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

+8 -1
+1 -1
src/applications/files/storage/PhabricatorFile.php
··· 287 287 // NOTE: Once we receive the first chunk, we'll detect its MIME type and 288 288 // update the parent file if a MIME type hasn't been provided. This matters 289 289 // for large media files like video. 290 - $mime_type = idx($params, 'mime-type'); 290 + $mime_type = idx($params, 'mime-type', ''); 291 291 if (!strlen($mime_type)) { 292 292 $file->setMimeType('application/octet-stream'); 293 293 }
+7
src/applications/files/storage/__tests__/PhabricatorFileTestCase.php
··· 532 532 $this->assertEqual(array(), $alternate_c); 533 533 } 534 534 535 + public function testNewChunkedFile() { 536 + $engine = new PhabricatorTestStorageEngine(); 537 + $file = PhabricatorFile::newChunkedFile($engine, 10, []); 538 + $this->assertTrue($file instanceof PhabricatorFile, 539 + pht('newChunkedFile returns a PhabricatorFile')); 540 + } 541 + 535 542 }