Skip to content

Commit 5720a38

Browse files
author
epriestley
committedNov 13, 2023
Correct Aphlict websocket URI construction after PHP8 compatibility changes
Summary: See D21862. Ref T13700. D21862 affected notification server URI generation behavior when a notification server client is configured with: 1. no "path" argument; and 2. "cluster.instance" not set. Condition (1) is not true default, and condition (2) is not true in my local environment, so it was easy for this to slip through the cracks. Apply the change suggested in D21862. Also fix a couple other string-null issues I caught locally. Test Plan: Generated notification server URIs under various simulated local conditions (no instance, path set) and everything seemed to be working correctly. Maniphest Tasks: T13700 Differential Revision: https://secure.phabricator.com/D21875
1 parent 40b272f commit 5720a38

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed
 

‎src/applications/auth/constants/PhabricatorCookies.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private static function parseNextURICookie($cookie) {
164164
// Old cookies look like: /uri
165165
// New cookies look like: timestamp,/uri
166166

167-
if (!strlen($cookie)) {
167+
if (!phutil_nonempty_string($cookie)) {
168168
return null;
169169
}
170170

‎src/applications/auth/controller/PhabricatorAuthSetExternalController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function handleRequest(AphrontRequest $request) {
4040
$text = PhabricatorAuthMessage::loadMessageText(
4141
$viewer,
4242
PhabricatorAuthLinkMessageType::MESSAGEKEY);
43-
if (!strlen($text)) {
43+
if (!phutil_nonempty_string($text)) {
4444
$text = pht(
4545
'You can link your %s account to an external account to '.
4646
'allow you to log in more easily in the future. To continue, choose '.

‎src/applications/notification/client/PhabricatorNotificationServerRef.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function getURI($to_path = null) {
147147
if ($to_path === null || !strlen($to_path)) {
148148
$to_path = '';
149149
} else {
150-
$to_path = '/'.ltrim($to_path, '/');
150+
$to_path = ltrim($to_path, '/');
151151
}
152152

153153
$base_path = $this->getPath();
@@ -156,7 +156,7 @@ public function getURI($to_path = null) {
156156
} else {
157157
$base_path = rtrim($base_path, '/');
158158
}
159-
$full_path = $base_path.$to_path;
159+
$full_path = $base_path.'/'.$to_path;
160160

161161
$uri = id(new PhutilURI('http://'.$this->getHost()))
162162
->setProtocol($this->getProtocol())

0 commit comments

Comments
 (0)
Failed to load comments.