From 2af1d36bc59ec882e20c67788df4c38a0fd37b37 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 8 Jul 2020 10:10:32 +0200 Subject: [PATCH] Skip special function optimization for redeclared disabled functions As pointed out on GH-5817. --- Zend/tests/bug79382.phpt | 6 ++---- Zend/zend_compile.c | 6 ++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Zend/tests/bug79382.phpt b/Zend/tests/bug79382.phpt index bc6099c4e4..5c1abe2d5f 100644 --- a/Zend/tests/bug79382.phpt +++ b/Zend/tests/bug79382.phpt @@ -6,13 +6,11 @@ disable_functions=strlen --EXPECT-- -int(6) +int(42) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 95342cc8e2..205704a634 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3954,6 +3954,12 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l return FAILURE; } + if (fbc->type != ZEND_INTERNAL_FUNCTION) { + /* If the function is part of disabled_functions, it may be redeclared as a userland + * function with a different implementation. Don't use the VM builtin in that case. */ + return FAILURE; + } + if (zend_args_contain_unpack(args)) { return FAILURE; } -- 2.40.0