Bug #71127 [Asn]: Define in auto_prepend_file is overwrite
| From: | laruence@php.net | Date: | Tue, 15 Dec 2015 15:10:50 +0000 |
| Subject: | Bug #71127 [Asn]: Define in auto_prepend_file is overwrite | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197908@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71127&edit=1
ID: 71127
Updated by: laruence@php.net
Reported by: g dot hue14 at gmail dot com
Summary: Define in auto_prepend_file is overwrite
Status: Assigned
Type: Bug
Package: opcache
Operating System: Debian 8
PHP Version: 5.6
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
fix is simple, just disable the constant replace in opcache, but it is a little pity we can not do
such optimization :<
https://gist.github.com/laruence/5b281615ec068c2234d8
Previous Comments:
------------------------------------------------------------------------
[2015-12-15 15:00:31] laruence@php.net
this is a opcache issue...
------------------------------------------------------------------------
[2015-12-15 14:23:43] g dot hue14 at gmail dot com
Description:
------------
Tested with wordpress and apache 2.4 / php-fpm
Define('ABSPATH','mypath') in an auto_prepend_file
When wp-load.php do "define( 'ABSPATH', dirname(__FILE__) . '/' );",
my personnal ABSPATH is overwrite with that new ABSPATH.
if i put "get_defined_constants();" in wp-load.php just before "define(
'ABSPATH', dirname(__FILE__) . '/' );", ABSPATH is not overwrite.
Tip:
if i put "get_defined_constants();" in the auto_prepend_file just after my first define,
ABSPATH is overwrite when wp-load.php do the define function.
if i put "get_defined_constants();" in a file include between the auto_prend_file and
wp-load.php (like index.php or wp-blog-header.php) ABSPATH is overwrite when wp-load.php do the
define function.
Expected result:
----------------
Normally (in php 5.4, php 5.6), a file cannot redefine a constante defined in an auto_prepend_file.
Actual result:
--------------
Constantes defined in an auto_prepend_file can be redefined
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71127&edit=1