Bug #69297 [Asn->Csd]: function_exists strange behavior with OPCache on disabled function
| From: | laruence@php.net | Date: | Wed, 25 Mar 2015 15:51:49 +0000 |
| Subject: | Bug #69297 [Asn->Csd]: function_exists strange behavior with OPCache on disabled function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191600@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69297&edit=1
ID: 69297
Updated by: laruence@php.net
Reported by: d dot ccigii at gmail dot com
Summary: function_exists strange behavior with OPCache on
disabled function
-Status: Assigned
+Status: Closed
Type: Bug
Package: opcache
Operating System: GNU/Linux, Centos 6.6
PHP Version: 5.6.7
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d380d1cb1ba48c41682f749692b78a10e91dd070
Log: Fixed Bug #69297 (function_exists strange behavior with OPCache on disabled function)
Previous Comments:
------------------------------------------------------------------------
[2015-03-25 11:53:54] d dot ccigii at gmail dot com
Description:
------------
I stumbled upon strange behavior of php function function_exists(), when called on disabled function
(in php.ini - disable_function).
The thing is, that if I provide the function name parameter directly as string, the result is
different than when provided as variable. When called first time, result is fine. But when the
result is served by the OPCache, results are wrong.
Tested in clean build of PHP 5.6 and 5.7, with shipped OPCache (Zend OPcache v7.0.4-dev). In PHP
5.5, the results are correct.
PHP Build:
./configure --prefix=/usr/local/php/5.6.7-test
PHP config:
disable_functions = posix_getpwuid
date.timezone = Europe/Prague
zend_extension=/usr/local/php/5.6.7-test/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
Test script:
---------------
<?
echo phpversion() . "\n";
$f='posix_getpwuid';
$r1=function_exists('posix_getpwuid');
$r2=function_exists($f);
echo "\n\n";
echo "string: ";
var_dump ($r1);
echo "var. : ";
var_dump ($r2);
echo "opcache status: ";
var_dump(opcache_get_status()['opcache_enabled']);
Expected result:
----------------
This is the result of the first call, this is how it should be:
# /usr/local/php/php-TEST/bin/php-cgi -c /data/web/php-test/ fce.php
X-Powered-By: PHP/5.6.7
Content-type: text/html; charset=UTF-8
5.6.7
string: bool(false) # <--- correct result
var. : bool(false)
opcache status: bool(true)
Actual result:
--------------
Any subsequent call:
# /usr/local/php/php-TEST/bin/php-cgi -c /data/web/php-test/ fce.php
X-Powered-By: PHP/5.6.7
Content-type: text/html; charset=UTF-8
5.6.7
string: bool(true) # <--- HERE IS THE ERROR
var. : bool(false)
opcache status: bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69297&edit=1