Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2695389
D25327.1734838799.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
D25327.1734838799.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
@@ -1052,6 +1052,7 @@
'DiffusionSSHWorkflow' => 'applications/diffusion/ssh/DiffusionSSHWorkflow.php',
'DiffusionSearchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionSearchQueryConduitAPIMethod.php',
'DiffusionServeController' => 'applications/diffusion/controller/DiffusionServeController.php',
+ 'DiffusionServeControllerTestCase' => 'applications/diffusion/controller/__tests__/DiffusionServeControllerTestCase.php',
'DiffusionServiceRef' => 'applications/diffusion/ref/DiffusionServiceRef.php',
'DiffusionSetPasswordSettingsPanel' => 'applications/diffusion/panel/DiffusionSetPasswordSettingsPanel.php',
'DiffusionSetupException' => 'applications/diffusion/exception/DiffusionSetupException.php',
@@ -7103,6 +7104,7 @@
'DiffusionSSHWorkflow' => 'PhabricatorSSHWorkflow',
'DiffusionSearchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionServeController' => 'DiffusionController',
+ 'DiffusionServeControllerTestCase' => 'PhabricatorTestCase',
'DiffusionServiceRef' => 'Phobject',
'DiffusionSetPasswordSettingsPanel' => 'PhabricatorSettingsPanel',
'DiffusionSetupException' => 'Exception',
diff --git a/src/applications/diffusion/controller/DiffusionServeController.php b/src/applications/diffusion/controller/DiffusionServeController.php
--- a/src/applications/diffusion/controller/DiffusionServeController.php
+++ b/src/applications/diffusion/controller/DiffusionServeController.php
@@ -183,8 +183,8 @@
// won't prompt users who provide a username but no password otherwise.
// See T10797 for discussion.
- $have_user = strlen(idx($_SERVER, 'PHP_AUTH_USER'));
- $have_pass = strlen(idx($_SERVER, 'PHP_AUTH_PW'));
+ $have_user = strlen(idx($_SERVER, 'PHP_AUTH_USER', ''));
+ $have_pass = strlen(idx($_SERVER, 'PHP_AUTH_PW', ''));
if ($have_user && $have_pass) {
$username = $_SERVER['PHP_AUTH_USER'];
$password = new PhutilOpaqueEnvelope($_SERVER['PHP_AUTH_PW']);
diff --git a/src/applications/diffusion/controller/__tests__/DiffusionServeControllerTestCase.php b/src/applications/diffusion/controller/__tests__/DiffusionServeControllerTestCase.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/controller/__tests__/DiffusionServeControllerTestCase.php
@@ -0,0 +1,22 @@
+<?php
+
+final class DiffusionServeControllerTestCase extends PhabricatorTestCase {
+
+ public function testHandleRequest() {
+ $aphront_request = new AphrontRequest('example.com', '/');
+ $diffusion_serve_controller = new DiffusionServeController();
+
+ try {
+ $diffusion_serve_controller->setRequest($aphront_request);
+ $result = $diffusion_serve_controller->handleRequest($aphront_request);
+ $this->assertTrue(true, 'handleRequest did not throw an error');
+ $this->assertTrue($result instanceof PhabricatorVCSResponse,
+ 'handleRequest() returns PhabricatorVCSResponse object');
+ } catch (Throwable $ex) {
+ $this->assertTrue(false,
+ 'handleRequest threw an exception:'.$ex->getMessage());
+ }
+
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 03:39 (20 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1025289
Default Alt Text
D25327.1734838799.diff (3 KB)
Attached To
Mode
D25327: PHP8.1 fix for DiffusionServeController serveRequest()
Attached
Detach File
Event Timeline
Log In to Comment