Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2682960
D25323.1734675476.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25323.1734675476.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -488,6 +488,7 @@
'DifferentialChangesetRenderer' => 'applications/differential/render/DifferentialChangesetRenderer.php',
'DifferentialChangesetSearchConduitAPIMethod' => 'applications/differential/conduit/DifferentialChangesetSearchConduitAPIMethod.php',
'DifferentialChangesetSearchEngine' => 'applications/differential/query/DifferentialChangesetSearchEngine.php',
+ 'DifferentialChangesetTestCase' => 'applications/differential/storage/__tests__/DifferentialChangesetTestCase.php',
'DifferentialChangesetTestRenderer' => 'applications/differential/render/DifferentialChangesetTestRenderer.php',
'DifferentialChangesetTwoUpRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpRenderer.php',
'DifferentialChangesetTwoUpTestRenderer' => 'applications/differential/render/DifferentialChangesetTwoUpTestRenderer.php',
@@ -6501,6 +6502,7 @@
'DifferentialChangesetRenderer' => 'Phobject',
'DifferentialChangesetSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
'DifferentialChangesetSearchEngine' => 'PhabricatorApplicationSearchEngine',
+ 'DifferentialChangesetTestCase' => 'PhabricatorTestCase',
'DifferentialChangesetTestRenderer' => 'DifferentialChangesetRenderer',
'DifferentialChangesetTwoUpRenderer' => 'DifferentialChangesetHTMLRenderer',
'DifferentialChangesetTwoUpTestRenderer' => 'DifferentialChangesetTestRenderer',
diff --git a/src/applications/differential/storage/DifferentialChangeset.php b/src/applications/differential/storage/DifferentialChangeset.php
--- a/src/applications/differential/storage/DifferentialChangeset.php
+++ b/src/applications/differential/storage/DifferentialChangeset.php
@@ -325,14 +325,16 @@
public function getOldStatePathVector() {
$path = $this->getOldFile();
- if (!strlen($path)) {
+ if (!phutil_nonempty_string($path)) {
$path = $this->getFilename();
}
- $path = trim($path, '/');
- $path = explode('/', $path);
+ if (!phutil_nonempty_string($path)) {
+ return null;
+ }
- return $path;
+ $path = trim($path, '/');
+ return explode('/', $path);
}
public function getNewStatePathVector() {
diff --git a/src/applications/differential/storage/__tests__/DifferentialChangesetTestCase.php b/src/applications/differential/storage/__tests__/DifferentialChangesetTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/applications/differential/storage/__tests__/DifferentialChangesetTestCase.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DifferentialChangesetTestCase extends PhabricatorTestCase {
+
+ public function testPhp81() {
+ $diff_change_set = new DifferentialChangeset();
+ try {
+ $old_state_vector = $diff_change_set->getOldStatePathVector();
+ $this->assertTrue(true, 'getOldStatePathVector did not throw an error');
+ } catch (Throwable $ex) {
+ $this->assertTrue(false,
+ 'getOldStatePathVector threw an exception:'.$ex->getMessage());
+ }
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 20, 06:17 (19 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1016528
Default Alt Text
D25323.1734675476.diff (3 KB)
Attached To
Mode
D25323: Fix PHP 8.1 issue in DifferentialChangeset getOldStatePathVector()
Attached
Detach File
Event Timeline
Log In to Comment