Bug #69081 [Opn]: $_SERVER variable sometimes undefined

From: Date: Thu, 19 Feb 2015 14:32:00 +0000
Subject: Bug #69081 [Opn]: $_SERVER variable sometimes undefined
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190818@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69081&edit=1

 ID:                 69081
 User updated by:    djbrainnrg at gmail dot com
 Reported by:        djbrainnrg at gmail dot com
 Summary:            $_SERVER variable sometimes undefined
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Windows 7 64bit
 PHP Version:        master-Git-2015-02-19 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

Here is my phpinfo page
http://i.imgur.com/qLasmoY.png


Previous Comments:
------------------------------------------------------------------------
[2015-02-19 14:31:00] djbrainnrg at gmail dot com

Description:
------------
Coming from this 64bit build -> http://windows.php.net/downloads/snaps/master/r400e65e/php-master-ts-windows-vc11-x64-r400e65e.zip

Running with apache 2.4.12 Win64.
For an unknown reason sometimes, very rare, the variable $_SERVER isn't available -> I have
the failure everytime at the same place but i cannot provide a reproducable example because that
only happens in combination with our used framework.

Also it only happens on the third request in a row.
Request 1: Main Page Load - Normal GET request
Request 2: Ajax Request to another page - Loaded directly on pageload
Request 3: Ajax Request to another page - Loaded directly on pageload => Error happens here

I can prevent the failure by adding just the line
$_SERVER;
at the begin of the script execution chain, lets say on the entry page.

Also i can prevent this failure with this option disabled in
auto_globals_jit = Off
in php.ini

Full debug_backtrace bellow, i know it may not help that mutch but i don't have anything better
for debugging right now.



Test script:
---------------
Cannot provide an example yet.

Actual result:
--------------
Notice:  Undefined variable: _SERVER in C:\www\ouced\live\modules\Ouced\src\class\Request.class.php
on line 198
array(11) {
  [0]=>
  array(7) {
    ["file"]=>
    string(42) "C:\www\ouced\live\modules\Caritas\init.php"
    ["line"]=>
    int(66)
    ["function"]=>
    string(7) "getHost"
    ["class"]=>
    string(13) "Ouced_Request"
    ["object"]=>
    object(Ouced_Request)#17 (1) {
      ["headers":"Ouced_Request":private]=>
      NULL
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(0) {
    }
  }
  [1]=>
  array(4) {
    ["file"]=>
    string(59) "C:\www\ouced\live\modules\Ouced\src\class\FS\File.class.php"
    ["line"]=>
    int(408)
    ["args"]=>
    array(1) {
      [0]=>
      string(42) "C:\www\ouced\live\modules\Caritas\init.php"
    }
    ["function"]=>
    string(12) "include_once"
  }
  [2]=>
  array(7) {
    ["file"]=>
    string(58) "C:\www\ouced\live\modules\Ouced\src\class\Module.class.php"
    ["line"]=>
    int(65)
    ["function"]=>
    string(11) "includeFile"
    ["class"]=>
    string(13) "Ouced_FS_File"
    ["object"]=>
    object(Ouced_FS_File)#15 (11) {
      ["directory":"Ouced_FS_File":private]=>
      NULL
      ["filename":"Ouced_FS_File":private]=>
      NULL
      ["filenameHash":"Ouced_FS_File":private]=>
      NULL
      ["extension":"Ouced_FS_File":private]=>
      NULL
      ["filesize":"Ouced_FS_File":private]=>
      NULL
      ["accessTime":"Ouced_FS_File":private]=>
      NULL
      ["modificationTime":"Ouced_FS_File":private]=>
      NULL
      ["contents":"Ouced_FS_File":private]=>
      NULL
      ["alias":"Ouced_FS_File":private]=>
      NULL
      ["absolutePath"]=>
      string(42) "C:\www\ouced\live\modules\Caritas\init.php"
      ["relativePath"]=>
      string(24) "modules\Caritas\init.php"
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(2) {
      [0]=>
      bool(true)
      [1]=>
      bool(false)
    }
  }
  [3]=>
  array(6) {
    ["file"]=>
    string(63) "C:\www\ouced\live\modules\Ouced\src\class\Initializer.class.php"
    ["line"]=>
    int(77)
    ["function"]=>
    string(14) "registerModule"
    ["class"]=>
    string(12) "Ouced_Module"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(1) {
      [0]=>
      string(7) "Caritas"
    }
  }
  [4]=>
  array(6) {
    ["file"]=>
    string(53) "C:\www\ouced\live\modules\Ruh\config\basic.config.php"
    ["line"]=>
    int(36)
    ["function"]=>
    string(14) "registerModule"
    ["class"]=>
    string(17) "Ouced_Initializer"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(1) {
      [0]=>
      string(7) "Caritas"
    }
  }
  [5]=>
  array(4) {
    ["file"]=>
    string(59) "C:\www\ouced\live\modules\Ouced\src\class\FS\File.class.php"
    ["line"]=>
    int(408)
    ["args"]=>
    array(1) {
      [0]=>
      string(53) "C:\www\ouced\live\modules\Ruh\config\basic.config.php"
    }
    ["function"]=>
    string(12) "include_once"
  }
  [6]=>
  array(7) {
    ["file"]=>
    string(58) "C:\www\ouced\live\modules\Ouced\src\class\Module.class.php"
    ["line"]=>
    int(60)
    ["function"]=>
    string(11) "includeFile"
    ["class"]=>
    string(13) "Ouced_FS_File"
    ["object"]=>
    object(Ouced_FS_File)#6 (11) {
      ["directory":"Ouced_FS_File":private]=>
      NULL
      ["filename":"Ouced_FS_File":private]=>
      NULL
      ["filenameHash":"Ouced_FS_File":private]=>
      NULL
      ["extension":"Ouced_FS_File":private]=>
      NULL
      ["filesize":"Ouced_FS_File":private]=>
      NULL
      ["accessTime":"Ouced_FS_File":private]=>
      NULL
      ["modificationTime":"Ouced_FS_File":private]=>
      NULL
      ["contents":"Ouced_FS_File":private]=>
      NULL
      ["alias":"Ouced_FS_File":private]=>
      NULL
      ["absolutePath"]=>
      string(53) "C:\www\ouced\live\modules\Ruh\config\basic.config.php"
      ["relativePath"]=>
      string(35) "modules\Ruh\config\basic.config.php"
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(0) {
    }
  }
  [7]=>
  array(6) {
    ["file"]=>
    string(57) "C:\www\ouced\live\modules\Ouced\src\class\Ouced.class.php"
    ["line"]=>
    int(164)
    ["function"]=>
    string(14) "registerModule"
    ["class"]=>
    string(12) "Ouced_Module"
    ["type"]=>
    string(2) "::"
    ["args"]=>
    array(2) {
      [0]=>
      string(3) "Ruh"
      [1]=>
      bool(true)
    }
  }
  [8]=>
  array(7) {
    ["file"]=>
    string(57) "C:\www\ouced\live\modules\Ouced\src\class\Ouced.class.php"
    ["line"]=>
    int(223)
    ["function"]=>
    string(8) "initCore"
    ["class"]=>
    string(5) "Ouced"
    ["object"]=>
    object(Ouced)#1 (0) {
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(0) {
    }
  }
  [9]=>
  array(7) {
    ["file"]=>
    string(40) "C:\www\ouced\live\modules\Ouced\init.php"
    ["line"]=>
    int(13)
    ["function"]=>
    string(16) "startApplication"
    ["class"]=>
    string(5) "Ouced"
    ["object"]=>
    object(Ouced)#1 (0) {
    }
    ["type"]=>
    string(2) "->"
    ["args"]=>
    array(0) {
    }
  }
  [10]=>
  array(4) {
    ["file"]=>
    string(46) "C:\www\ouced\live\modules\Ruh\public\index.php"
    ["line"]=>
    int(8)
    ["args"]=>
    array(1) {
      [0]=>
      string(40) "C:\www\ouced\live\modules\Ouced\init.php"
    }
    ["function"]=>
    string(12) "include_once"
  }
}



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=69081&edit=1


Thread (9 messages)

« previous php.bugs (#190818) next »