File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -1833,6 +1833,17 @@ bar1
1833
1833
) ;
1834
1834
expect ( $_SERVER ) . toHaveProperty ( 'HTTP_X_IS_AJAX' , 'true' ) ;
1835
1835
expect ( $_SERVER ) . toHaveProperty ( 'SERVER_PORT' , '1235' ) ;
1836
+ expect ( $_SERVER ) . toHaveProperty ( 'QUERY_STRING' , 'a=b' ) ;
1837
+ } ) ;
1838
+
1839
+ it ( 'Should have an empty QUERY_STRING when the URI has no query string' , async ( ) => {
1840
+ const response = await php . run ( {
1841
+ code : `<?php echo json_encode($_SERVER);` ,
1842
+ relativeUri : '/test.php' ,
1843
+ } ) ;
1844
+ const bodyText = new TextDecoder ( ) . decode ( response . bytes ) ;
1845
+ const $_SERVER = JSON . parse ( bodyText ) ;
1846
+ expect ( $_SERVER ) . toHaveProperty ( 'QUERY_STRING' , '' ) ;
1836
1847
} ) ;
1837
1848
} ) ;
1838
1849
Original file line number Diff line number Diff line change @@ -577,15 +577,16 @@ export class PHP implements Disposable {
577
577
[ STRING ] ,
578
578
[ uri ]
579
579
) ;
580
+ let queryString = '' ;
580
581
if ( uri . includes ( '?' ) ) {
581
- const queryString = uri . substring ( uri . indexOf ( '?' ) + 1 ) ;
582
- this [ __private__dont__use ] . ccall (
583
- 'wasm_set_query_string' ,
584
- null ,
585
- [ STRING ] ,
586
- [ queryString ]
587
- ) ;
582
+ queryString = uri . substring ( uri . indexOf ( '?' ) + 1 ) ;
588
583
}
584
+ this [ __private__dont__use ] . ccall (
585
+ 'wasm_set_query_string' ,
586
+ null ,
587
+ [ STRING ] ,
588
+ [ queryString ]
589
+ ) ;
589
590
}
590
591
591
592
#setRequestHost( host : string ) {
You can’t perform that action at this time.
0 commit comments