@@ -536,9 +536,11 @@ func TestPHPServerGlobals(t *testing.T) {
536536
537537func TestWorkerPHPServerGlobals (t * testing.T ) {
538538 documentRoot , _ := filepath .Abs ("../testdata" )
539+ documentRoot2 , _ := filepath .Abs ("../caddy" )
539540 scriptFilename := documentRoot + string (filepath .Separator ) + "server-globals.php"
540541 testPortNum , _ := strconv .Atoi (testPort )
541542 testPortTwo := strconv .Itoa (testPortNum + 1 )
543+ testPortThree := strconv .Itoa (testPortNum + 2 )
542544
543545 tester := caddytest .NewTester (t )
544546 initServer (t , tester , `
@@ -571,6 +573,18 @@ func TestWorkerPHPServerGlobals(t *testing.T) {
571573 }
572574 }
573575 }
576+
577+ http://localhost:` + testPortThree + ` {
578+ php_server {
579+ root ./
580+ index server-globals.php
581+ worker {
582+ file ../testdata/server-globals.php
583+ num 1
584+ match *
585+ }
586+ }
587+ }
574588 ` , "caddyfile" )
575589
576590 // === Site 1: global worker with php_server ===
@@ -620,6 +634,29 @@ func TestWorkerPHPServerGlobals(t *testing.T) {
620634 "DOCUMENT_ROOT: " + documentRoot + "<br>" +
621635 "REQUEST_URI: /server-globals.php/en<br>" ,
622636 )
637+
638+ // === Site 3: php_server with its own match worker ===
639+ tester .AssertGetResponse (
640+ "http://localhost:" + testPortThree + "/en" ,
641+ http .StatusOK ,
642+ "SCRIPT_NAME: " + documentRoot + "/server-globals.php<br>" +
643+ "SCRIPT_FILENAME: " + scriptFilename + "<br>" +
644+ "PHP_SELF: " + documentRoot + "/server-globals.php<br>" +
645+ "PATH_INFO: <br>" +
646+ "DOCUMENT_ROOT: " + documentRoot2 + "<br>" +
647+ "REQUEST_URI: /en<br>" ,
648+ )
649+
650+ tester .AssertGetResponse (
651+ "http://localhost:" + testPortThree + "/server-globals.php/en" ,
652+ http .StatusOK ,
653+ "SCRIPT_NAME: " + documentRoot + "/server-globals.php<br>" +
654+ "SCRIPT_FILENAME: " + scriptFilename + "<br>" +
655+ "PHP_SELF: " + documentRoot + "/server-globals.php/en<br>" +
656+ "PATH_INFO: /en<br>" +
657+ "DOCUMENT_ROOT: " + documentRoot2 + "<br>" +
658+ "REQUEST_URI: /server-globals.php/en<br>" ,
659+ )
623660}
624661
625662func TestMetrics (t * testing.T ) {
0 commit comments