}
/* }}} */
-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;
}
/* }}} */
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")) {
} 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);
} 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);
} 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);
} 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);
} 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);