php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70108 sometimes empty $_SERVER['QUERY_STRING']
Submitted: 2015-07-22 07:07 UTC Modified: 2015-08-01 08:13 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: bugzilla77 at gmail dot com Assigned: ab (profile)
Status: Closed Package: *General Issues
PHP Version: 7.0.0beta1 OS: Win7 32/64
Private report: No CVE-ID: None
 [2015-07-22 07:07 UTC] bugzilla77 at gmail dot com
Description:
------------
Sometimes empty $_SERVER['QUERY_STRING']

Tested on four servers (32 or 64bit Windows 7).

Apache 2.4.16 Win64
http://www.apachelounge.com/download/VC14/binaries/httpd-2.4.16-win64-VC14.zip

Apache 2.4.16 Win32
http://www.apachelounge.com/download/VC14/binaries/httpd-2.4.16-win32-VC14.zip

MS Visual C++ 2015 Redistributable 14.0.23026
https://go.microsoft.com/fwlink/?LinkId=615459
https://go.microsoft.com/fwlink/?LinkId=615460

PHP Thread Safe as Apache module.

---

I discovered this problem because I use "get.php?_____" to get page images.
PHP 7.0.0beta1 does not display all images on pages.

---

If I replace PHP 7.0.0beta1 to PHP 5.6.11 the problem does not exists. Only PHP 7.0.0beta1.

Test script:
---------------
query.php
---------

<?php
 print($_SERVER['QUERY_STRING']?:'NO QUERY_STRING');
?>



query.html
----------

<!DOCTYPE html>
<html>
 <body>
  <div>Try F5 (reload). PHP 7.0.0 beta 1</div>
  <iframe style="width:500px;height:30px" src="query.php?01"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?02"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?03"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?04"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?05"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?06"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?07"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?08"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?09"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?10"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?11"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?12"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?13"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?14"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?15"></iframe><br/>
  <iframe style="width:500px;height:30px" src="query.php?16"></iframe><br/>
 </body>
</html>

Expected result:
----------------
digits in all lines

Actual result:
--------------
"NO QUERY_STRING" in some lines

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-22 07:11 UTC] bugzilla77 at gmail dot com
PS.
$_SERVER['REQUEST_URI'] is also bugy
 [2015-07-22 09:28 UTC] yohgaki@php.net
Which MPM you're using?
 [2015-07-22 12:11 UTC] bugzilla77 at gmail dot com
I have default Apache httpd.conf plus:

PHPINIDir c:/php7
LoadModule php7_module c:/php7/php7apache2_4.dll
AddType application/x-httpd-php .php

PS What is MPM abbreviation?
 [2015-07-23 08:28 UTC] laruence@php.net
I can not reproduce this with php-fpm (linux centos 6.4). maybe a windows special issue?
 [2015-07-26 12:32 UTC] dominique at ottello dot net
Same problem with 7.0.0 beta 2
[26-Jul-2015 14:06:51 Europe/Paris] PHP Notice:  Undefined variable: _SERVER in J:\wamp\www\index.php on line 25
[26-Jul-2015 14:06:51 Europe/Paris] PHP Notice:  Undefined variable: _SERVER in J:\wamp\www\index.php on line 259
Line  25 : $server_software = $_SERVER['SERVER_SOFTWARE'];
Line 259 : if (strpos($_SERVER["HTTP_USER_AGENT"], "MSIE 7") === false && strpos($_SERVER["HTTP_USER_AGENT"], "MSIE 8") === false)
 [2015-07-29 00:34 UTC] cmb@php.net
> What is MPM abbreviation?

MPM means multi-processing module, see
<http://httpd.apache.org/docs/2.4/en/mpm.html>.
 [2015-07-29 08:00 UTC] dominique at ottello dot net
Hi,

J:\wamp\bin\apache\apache2.4.16\bin>httpd -l
Compiled in modules:
  core.c
  mod_win32.c
  mpm_winnt.c
  http_core.c
  mod_so.c
Always same problem with 7.0.0 beta2
Never any similar problem for years, with Apache 2.4.x and Windows 7
And now, no problems with the same Apache and PHP versions: 5.3.29 or 5.4.43 or 5.5.27 or 5.6.11.
 [2015-07-30 05:35 UTC] laruence@php.net
-Assigned To: +Assigned To: ab
 [2015-07-30 05:35 UTC] laruence@php.net
maybe ZTS issue?
 [2015-07-30 07:09 UTC] ab@php.net
-Status: Assigned +Status: Verified
 [2015-07-30 07:09 UTC] ab@php.net
Thanks for the ping, Hui. Yeah, it has to be TS issue, i reproduce this with mpm_winnt so expect same with mpm_worker.
 [2015-07-30 20:03 UTC] ab@php.net
Debugged through this and seems it's a TS only issue with auto_globals_jit. Just to mention - set it no 0 as a workaround till to fix is there.

Thanks.
 [2015-07-30 20:04 UTC] ab@php.net
oh ... set it *to* 0 ... thanks )
 [2015-07-31 11:33 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c
Log: Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING']
 [2015-07-31 11:33 UTC] ab@php.net
-Status: Verified +Status: Closed
 [2015-07-31 12:41 UTC] dominique at ottello dot net
Hi,

With auto_globals_jit = Off it is OK for me.
No more errors.

Thanks
 [2015-07-31 14:09 UTC] ab@php.net
@Dominique now that it is fixed, could you please check some latest snapshot with auto_globals_jit on?

Thanks.
 [2015-08-01 08:04 UTC] dominique at ottello dot net
Hi,

I have done extensive testing with PHP 7.0.0 beta 2, Apache 2.4.12 and 2.4.16 and Windows 7 Pro and 10 Pro, each time when I handed auto_globals_jit = On, the error Undefined variable: _SERVER returned.
However, never error with auto_globals_jit = Off.

I apologize for my wrong English.
 [2015-08-01 08:13 UTC] ab@php.net
Hi Dominique,

thanks for the checks.

what I meant is taking a snapshot, like this is the latest ATM http://windows.php.net/downloads/snaps/master/r78eab00/ (or you can find the latest at http://windows.php.net/snapshots/). That one or any later should contain the correct auto_globals_jit behavior. Beta2 of course doesn't contain this fix.

Thanks.
 [2015-08-04 20:54 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c
Log: Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING']
 [2016-07-20 11:37 UTC] davey@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=b604716fb6fccfcbaafc8ecf46d1cf5ddb6c715c
Log: Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING']
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC