mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
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
This commit is contained in:
parent
dbc101ca8a
commit
27fa498966
2 changed files with 8 additions and 1 deletions
|
@ -287,7 +287,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
||||||
// NOTE: Once we receive the first chunk, we'll detect its MIME type and
|
// NOTE: Once we receive the first chunk, we'll detect its MIME type and
|
||||||
// update the parent file if a MIME type hasn't been provided. This matters
|
// update the parent file if a MIME type hasn't been provided. This matters
|
||||||
// for large media files like video.
|
// for large media files like video.
|
||||||
$mime_type = idx($params, 'mime-type');
|
$mime_type = idx($params, 'mime-type', '');
|
||||||
if (!strlen($mime_type)) {
|
if (!strlen($mime_type)) {
|
||||||
$file->setMimeType('application/octet-stream');
|
$file->setMimeType('application/octet-stream');
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,4 +532,11 @@ final class PhabricatorFileTestCase extends PhabricatorTestCase {
|
||||||
$this->assertEqual(array(), $alternate_c);
|
$this->assertEqual(array(), $alternate_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testNewChunkedFile() {
|
||||||
|
$engine = new PhabricatorTestStorageEngine();
|
||||||
|
$file = PhabricatorFile::newChunkedFile($engine, 10, []);
|
||||||
|
$this->assertTrue($file instanceof PhabricatorFile,
|
||||||
|
pht('newChunkedFile returns a PhabricatorFile'));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue