diff options
-rw-r--r-- | Zend/zend_compile.c | 12 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 2 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 8 |
3 files changed, 13 insertions, 9 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 23b6759167..0b9a50cdb1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3519,16 +3519,19 @@ static int zend_compile_func_in_array(znode *result, zend_ast_list *args) /* {{{ } /* }}} */ -int zend_compile_func_count(znode *result, zend_ast_list *args) /* {{{ */ +int zend_compile_func_count(znode *result, zend_ast_list *args, zend_string *lcname) /* {{{ */ { znode arg_node; + zend_op *opline; if (args->children != 1) { return FAILURE; } zend_compile_expr(&arg_node, args->child[0]); - zend_emit_op_tmp(result, ZEND_COUNT, &arg_node, NULL); + opline = zend_emit_op_tmp(result, ZEND_COUNT, &arg_node, NULL); + opline->extended_value = zend_string_equals_literal(lcname, "sizeof"); + return SUCCESS; } /* }}} */ @@ -3707,8 +3710,9 @@ int zend_try_compile_special_func(znode *result, zend_string *lcname, zend_ast_l return zend_compile_func_cuf(result, args, lcname); } else if (zend_string_equals_literal(lcname, "in_array")) { return zend_compile_func_in_array(result, args); - } else if (zend_string_equals_literal(lcname, "count")) { - return zend_compile_func_count(result, args); + } else if (zend_string_equals_literal(lcname, "count") + || zend_string_equals_literal(lcname, "sizeof")) { + return zend_compile_func_count(result, args, lcname); } else if (zend_string_equals_literal(lcname, "get_class")) { return zend_compile_func_get_class(result, args); } else if (zend_string_equals_literal(lcname, "get_called_class")) { diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 917cf16f24..d47ce83913 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -8445,7 +8445,7 @@ ZEND_VM_COLD_CONST_HANDLER(190, ZEND_COUNT, CONST|TMP|VAR|CV, UNUSED) } else { count = 1; } - zend_error(E_WARNING, "count(): Parameter must be an array or an object that implements Countable"); + zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); } while (0); ZVAL_LONG(EX_VAR(opline->result.var), count); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 0138bac77f..99e28f750b 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -9594,7 +9594,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CONST_ } else { count = 1; } - zend_error(E_WARNING, "count(): Parameter must be an array or an object that implements Countable"); + zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); } while (0); ZVAL_LONG(EX_VAR(opline->result.var), count); @@ -20413,7 +20413,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_TMP_UNUSED_HANDLER( } else { count = 1; } - zend_error(E_WARNING, "count(): Parameter must be an array or an object that implements Countable"); + zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); } while (0); ZVAL_LONG(EX_VAR(opline->result.var), count); @@ -29826,7 +29826,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_VAR_UNUSED_HANDLER( } else { count = 1; } - zend_error(E_WARNING, "count(): Parameter must be an array or an object that implements Countable"); + zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); } while (0); ZVAL_LONG(EX_VAR(opline->result.var), count); @@ -51784,7 +51784,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COUNT_SPEC_CV_UNUSED_HANDLER(Z } else { count = 1; } - zend_error(E_WARNING, "count(): Parameter must be an array or an object that implements Countable"); + zend_error(E_WARNING, "%s(): Parameter must be an array or an object that implements Countable", opline->extended_value ? "sizeof" : "count"); } while (0); ZVAL_LONG(EX_VAR(opline->result.var), count); |