php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69297 function_exists strange behavior with OPCache on disabled function
Submitted: 2015-03-25 11:53 UTC Modified: 2015-03-25 13:24 UTC
From: d dot ccigii at gmail dot com Assigned: laruence (profile)
Status: Closed Package: opcache
PHP Version: 5.6.7 OS: GNU/Linux, Centos 6.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: d dot ccigii at gmail dot com
New email:
PHP Version: OS:

 

 [2015-03-25 11:53 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-25 13:24 UTC] laruence@php.net
-Assigned To: +Assigned To: laruence
 [2015-03-25 15:51 UTC] laruence@php.net
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)
 [2015-03-25 15:51 UTC] laruence@php.net
-Status: Assigned +Status: Closed
 [2015-03-25 15:51 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e46e9a3d22c22ec567423c25f83a6fd7f9655c52
Log: Fixed Bug #69297 (function_exists strange behavior with OPCache on disabled function)
 [2015-03-30 12:21 UTC] laruence@php.net
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)
 [2016-07-20 11:39 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e46e9a3d22c22ec567423c25f83a6fd7f9655c52
Log: Fixed Bug #69297 (function_exists strange behavior with OPCache on disabled function)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC