From d380d1cb1ba48c41682f749692b78a10e91dd070 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 25 Mar 2015 23:27:50 +0800 Subject: [PATCH] Fixed Bug #69297 (function_exists strange behavior with OPCache on disabled function) is_callable returns true for disable_functions, but function_exists return false for it. --- NEWS | 4 ++++ ext/opcache/Optimizer/pass1_5.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7760da0c5a..4244c8b7b6 100644 --- 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) diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index 731040e960..f4091921b3 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -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)); -- 2.50.1