Bug #77183 [Opn]: $_SERVER is not set in preloaded classes

From: Date: Wed, 21 Nov 2018 18:15:54 +0000
Subject: Bug #77183 [Opn]: $_SERVER is not set in preloaded classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218078@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77183&edit=1

 ID:                 77183
 Updated by:         cmb@php.net
 Reported by:        benjamin dot morel at gmail dot com
 Summary:            $_SERVER is not set in preloaded classes
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   Fedora 29
 PHP Version:        master-Git-2018-11-20 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Works for me.


Previous Comments:
------------------------------------------------------------------------
[2018-11-20 15:38:44] benjamin dot morel at gmail dot com

Description:
------------
When using a preloaded class that references $_SERVER, the variable is not set.
When setting auto_globals_jit to Off, it works.

Test script:
---------------
index.php
========

<?php

header('Content-Type: text/plain');

print_r(Test::getServer());



class.php
=========

<?php

class Test {
        public static function getServer()
        {
                return $_SERVER;
        }
}



preload.php
===========

<?php

opcache_compile_file('class.php');

Expected result:
----------------
Array(
  ...
)

Actual result:
--------------
Notice: Undefined variable: _SERVER in /var/www/html/class.php on line 6


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



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


Thread (6 messages)

« previous php.bugs (#218078) next »