php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64346
Patch bug64346-2.diff revision 2013-04-12 06:50 UTC by laruence@php.net
Patch bug54346.diff revision 2013-03-04 13:25 UTC by dmitry at zend dot com

Patch bug64346-2.diff for *General Issues Bug #64346

Patch version 2013-04-12 06:50 UTC

Return to Bug #64346 | Download this patch
Patch Revisions:

Developer: laruence@php.net

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 82275ce..85a1d30 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2035,6 +2035,7 @@ void zend_do_begin_dynamic_function_call(znode *function_name, int ns_call TSRML
 		opline->op2_type = IS_CONST;
 		opline->op2.constant = zend_add_ns_func_name_literal(CG(active_op_array), &function_name->u.constant TSRMLS_CC);
 		GET_CACHE_SLOT(opline->op2.constant);
+		GET_CACHE_SLOT(opline->op2.constant + 2);
 	} else {
 		opline->opcode = ZEND_INIT_FCALL_BY_NAME;
 		SET_UNUSED(opline->op1);
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index f051c1a..37f88c0 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -2473,16 +2473,18 @@ ZEND_VM_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST)
 	func_name = opline->op2.literal + 1;
 	if (CACHED_PTR(opline->op2.literal->cache_slot)) {
 		EX(fbc) = CACHED_PTR(opline->op2.literal->cache_slot);
-	} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE) {
+	} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc)) == SUCCESS) {
+		CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
+	} else 	if (CACHED_PTR((opline->op2.literal + 2)->cache_slot)) {
+		EX(fbc) = CACHED_PTR((opline->op2.literal + 2)->cache_slot);
+	} else {
 		func_name++;
 		if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE)) {
 			SAVE_OPLINE();
 			zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
 		} else {
-			CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
+			CACHE_PTR((opline->op2.literal + 2)->cache_slot, EX(fbc));
 		}
-	} else {
-		CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
 	}
 
 	EX(object) = NULL;
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index 07082d4..4773718 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -1331,16 +1331,18 @@ static int ZEND_FASTCALL  ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPC
 	func_name = opline->op2.literal + 1;
 	if (CACHED_PTR(opline->op2.literal->cache_slot)) {
 		EX(fbc) = CACHED_PTR(opline->op2.literal->cache_slot);
-	} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE) {
+	} else if (zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc)) == SUCCESS) {
+		CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
+	} else 	if (CACHED_PTR((opline->op2.literal + 2)->cache_slot)) {
+		EX(fbc) = CACHED_PTR((opline->op2.literal + 2)->cache_slot);
+	} else {
 		func_name++;
 		if (UNEXPECTED(zend_hash_quick_find(EG(function_table), Z_STRVAL(func_name->constant), Z_STRLEN(func_name->constant)+1, func_name->hash_value, (void **) &EX(fbc))==FAILURE)) {
 			SAVE_OPLINE();
 			zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
 		} else {
-			CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
+			CACHE_PTR((opline->op2.literal + 2)->cache_slot, EX(fbc));
 		}
-	} else {
-		CACHE_PTR(opline->op2.literal->cache_slot, EX(fbc));
 	}
 
 	EX(object) = NULL;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 12:01:27 2024 UTC