File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -639,9 +639,9 @@ func TestWorkerPHPServerGlobals(t *testing.T) {
639639 tester .AssertGetResponse (
640640 "http://localhost:" + testPortThree + "/en" ,
641641 http .StatusOK ,
642- "SCRIPT_NAME: " + documentRoot + "/server-globals.php <br>"+
642+ "SCRIPT_NAME: <br>" +
643643 "SCRIPT_FILENAME: " + scriptFilename + "<br>" +
644- "PHP_SELF: " + documentRoot + "/server-globals.php <br>"+
644+ "PHP_SELF: <br>" +
645645 "PATH_INFO: <br>" +
646646 "DOCUMENT_ROOT: " + documentRoot2 + "<br>" +
647647 "REQUEST_URI: /en<br>" ,
@@ -650,9 +650,9 @@ func TestWorkerPHPServerGlobals(t *testing.T) {
650650 tester .AssertGetResponse (
651651 "http://localhost:" + testPortThree + "/server-globals.php/en" ,
652652 http .StatusOK ,
653- "SCRIPT_NAME: " + documentRoot + "/server-globals.php <br>"+
653+ "SCRIPT_NAME: <br>" +
654654 "SCRIPT_FILENAME: " + scriptFilename + "<br>" +
655- "PHP_SELF: " + documentRoot + "/server-globals.php /en<br>"+
655+ "PHP_SELF: /en<br>" +
656656 "PATH_INFO: /en<br>" +
657657 "DOCUMENT_ROOT: " + documentRoot2 + "<br>" +
658658 "REQUEST_URI: /server-globals.php/en<br>" ,
Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ func splitCgiPath(fc *frankenPHPContext) {
213213 // If a worker is already assigned explicitly, derive SCRIPT_NAME from its filename
214214 if fc .worker != nil {
215215 fc .scriptFilename = fc .worker .fileName
216- fc .scriptName = filepath .ToSlash (strings .TrimPrefix (fc .worker .fileName , fc .documentRoot ))
216+ if strings .HasPrefix (fc .worker .fileName , fc .documentRoot ) {
217+ fc .scriptName = filepath .ToSlash (strings .TrimPrefix (fc .worker .fileName , fc .documentRoot ))
218+ }
217219 return
218220 }
219221
You can’t perform that action at this time.
0 commit comments