]> granicus.if.org Git - php/commitdiff
Fixed Bug #69297 (function_exists strange behavior with OPCache on disabled function)
authorXinchen Hui <laruence@php.net>
Wed, 25 Mar 2015 15:27:50 +0000 (23:27 +0800)
committerXinchen Hui <laruence@php.net>
Wed, 25 Mar 2015 15:34:02 +0000 (23:34 +0800)
is_callable returns true for disable_functions, but function_exists
return false for it.

NEWS
ext/opcache/Optimizer/pass1_5.c

diff --git a/NEWS b/NEWS
index 7760da0c5acfae37628e4999e004838f14da46b0..4244c8b7b6ccce1071c15adf008dc955bcd225da 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,10 @@ PHP                                                                        NEWS
   . Fixed bug #69203 (FILTER_FLAG_STRIP_HIGH doesn't strip ASCII 127). (Jeff
     Welch)
 
+- Opcache:
+  . Fixed bug #69297 (function_exists strange behavior with OPCache on
+    disabled function). (Laruence)
+
 - OpenSSL
   . Fixed bugs #68853, #65137 (Buffered crypto stream data breaks IO polling
     in stream_select() contexts) (Chris Wright)
index 731040e96048f1673bd0e7101312a37b224694b7..f4091921b3d44b7d019d414b9569fe81e1030bd9 100644 (file)
@@ -380,7 +380,12 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
                                                        func->type == ZEND_INTERNAL_FUNCTION &&
                                                        func->module->type == MODULE_PERSISTENT) {
                                                zval t;
-                                               ZVAL_BOOL(&t, 1);
+                                               if (Z_STRLEN(ZEND_OP1_LITERAL(opline)) == sizeof("is_callable") - 1 ||
+                                                          func->handler != ZEND_FN(display_disabled_function)) {
+                                                       ZVAL_BOOL(&t, 1);
+                                               } else {
+                                                       ZVAL_BOOL(&t, 0);
+                                               }
                                                if (replace_var_by_const(op_array, opline + 1, ZEND_RESULT(opline).var, &t TSRMLS_CC)) {
                                                        literal_dtor(&ZEND_OP1_LITERAL(opline - 1));
                                                        MAKE_NOP((opline - 1));