Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/PhpEnvironment/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ protected function detectRequestUri()
439439
}
440440

441441
if ($requestUri !== null) {
442-
return preg_replace('#^[^:]+://[^/]+#', '', $requestUri);
442+
return preg_replace('#^[^/:]+://[^/]+#', '', $requestUri);
443443
}
444444

445445
// IIS 5.0, PHP as CGI.

test/PhpEnvironment/RequestTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,17 @@ public static function baseUrlAndPathProvider()
204204
'/html/index.php',
205205
'/html'
206206
),
207+
208+
//Test when url quert contains a full http url
209+
array(
210+
array(
211+
'REQUEST_URI' => '/html/index.php?url=http://test.example.com/path/&foo=bar',
212+
'PHP_SELF' => '/html/index.php',
213+
'SCRIPT_FILENAME' => '/var/web/html/index.php',
214+
),
215+
'/html/index.php',
216+
'/html'
217+
),
207218
);
208219
}
209220

@@ -357,6 +368,18 @@ public static function serverHostnameProvider()
357368
'443',
358369
'/news',
359370
),
371+
372+
//Test when url quert contains a full http url
373+
array(
374+
array(
375+
'SERVER_NAME' => 'test.example.com',
376+
'REQUEST_URI' => '/html/index.php?url=http://test.example.com/path/&foo=bar',
377+
),
378+
'test.example.com',
379+
'80',
380+
'/html/index.php?url=http://test.example.com/path/&foo=bar',
381+
),
382+
360383
);
361384
}
362385

0 commit comments

Comments
 (0)