com php-src: Fixed Bug #68104 (Segfault while pre-evaluating a disabled function): NEWS Zend/zend_API.c ext/opcache/tests/bug6 8104.phpt
| From: | Xinchen Hui | Date: | Fri, 31 Oct 2014 09:32:23 +0000 |
| Subject: | com php-src: Fixed Bug #68104 (Segfault while pre-evaluating a disabled function): NEWS Zend/zend_API.c ext/opcache/tests/bug6 8104.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82913@lists.php.net to get a copy of this message | ||
Commit: d9d181e5ad41128a97a6e01d14fb766ff7bf31a8
Author: Xinchen Hui <laruence@php.net> Fri, 31 Oct 2014 17:32:23 +0800
Parents: 9e1da42af18265d007b5246f01895d3cafc78939
Branches: PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9d181e5ad41128a97a6e01d14fb766ff7bf31a8
Log:
Fixed Bug #68104 (Segfault while pre-evaluating a disabled function)
Bugs:
https://bugs.php.net/68104
Changed paths:
M NEWS
M Zend/zend_API.c
A ext/opcache/tests/bug68104.phpt
Diff:
diff --git a/NEWS b/NEWS
index 478fa1d..0d85620 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP NEWS
?? ??? 2014, PHP 5.6.3
- Core:
+ . Fixed bug #68104 (Segfault while pre-evaluating a disabled function).
+ (Laruence)
. Implemented 64-bit format codes for pack() and unpack(). (Leigh)
. Fixed bug #51800 (proc_open on Windows hangs forever). (Anatol)
. Fixed bug #67633 (A foreach on an array returned from a function not doing
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 8472cd7..a465721 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2635,18 +2635,15 @@ ZEND_API ZEND_FUNCTION(display_disabled_function)
}
/* }}} */
-static zend_function_entry disabled_function[] = {
- ZEND_FE(display_disabled_function, NULL)
- ZEND_FE_END
-};
-
ZEND_API int zend_disable_function(char *function_name, uint function_name_length TSRMLS_DC) /* {{{
*/
{
- if (zend_hash_del(CG(function_table), function_name, function_name_length+1)==FAILURE) {
- return FAILURE;
+ zend_internal_function *func;
+ if (zend_hash_find(CG(function_table), function_name, function_name_length+1, (void
**)&func)==SUCCESS) {
+ func->arg_info = NULL;
+ func->handler = ZEND_FN(display_disabled_function);
+ return SUCCESS;
}
- disabled_function[0].fname = function_name;
- return zend_register_functions(NULL, disabled_function, CG(function_table), MODULE_PERSISTENT
TSRMLS_CC);
+ return FAILURE;
}
/* }}} */
diff --git a/ext/opcache/tests/bug68104.phpt b/ext/opcache/tests/bug68104.phpt
new file mode 100644
index 0000000..521486e
--- /dev/null
+++ b/ext/opcache/tests/bug68104.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Bug #68104 (Segfault while pre-evaluating a disabled function)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+disable_functions=dl
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+var_dump(is_callable("dl"));
+--EXPECT--
+bool(true)