become consistent with zend for too few param error

I've been fighting with these in the importer. What do you think about being consistent? It gives an extra param of info too.
Esse commit está contido em:
ptarjan
2013-04-02 20:23:48 -07:00
commit de Sara Golemon
commit f7b2fac580
35 arquivos alterados com 127 adições e 109 exclusões
+18 -12
Ver Arquivo
@@ -567,12 +567,9 @@ void throw_pending_exception(ThreadInfo *info) {
throw e;
}
Variant throw_missing_arguments(const char *fn, int num, int level /* = 0 */) {
if (level == 2 || RuntimeOption::ThrowMissingArguments) {
raise_error("Missing argument %d for %s()", num, fn);
} else {
raise_warning("Missing argument %d for %s()", num, fn);
}
Variant throw_missing_arguments(const char *fn, int expected, int got,
int level /* = 0 */) {
throw_missing_arguments_nr(fn, expected, got, level);
return uninit_null();
}
@@ -588,7 +585,7 @@ Variant throw_toomany_arguments(const char *fn, int num, int level /* = 0 */) {
Variant throw_wrong_arguments(const char *fn, int count, int cmin, int cmax,
int level /* = 0 */) {
if (cmin >= 0 && count < cmin) {
return throw_missing_arguments(fn, count + 1, level);
return throw_missing_arguments(fn, cmin, count, level);
}
if (cmax >= 0 && count > cmax) {
return throw_toomany_arguments(fn, cmax, level);
@@ -597,11 +594,20 @@ Variant throw_wrong_arguments(const char *fn, int count, int cmin, int cmax,
return uninit_null();
}
void throw_missing_arguments_nr(const char *fn, int num, int level /* = 0 */) {
void throw_missing_arguments_nr(const char *fn, int expected, int got,
int level /* = 0 */) {
if (level == 2 || RuntimeOption::ThrowMissingArguments) {
raise_error("Missing argument %d for %s()", num, fn);
if (expected == 1) {
raise_error(Strings::MISSING_ARGUMENT, fn, got);
} else {
raise_error(Strings::MISSING_ARGUMENTS, fn, expected, got);
}
} else {
raise_warning("Missing argument %d for %s()", num, fn);
if (expected == 1) {
raise_warning(Strings::MISSING_ARGUMENT, fn, got);
} else {
raise_warning(Strings::MISSING_ARGUMENTS, fn, expected, got);
}
}
}
@@ -616,11 +622,11 @@ void throw_toomany_arguments_nr(const char *fn, int num, int level /* = 0 */) {
void throw_wrong_arguments_nr(const char *fn, int count, int cmin, int cmax,
int level /* = 0 */) {
if (cmin >= 0 && count < cmin) {
throw_missing_arguments(fn, count + 1, level);
throw_missing_arguments_nr(fn, cmin, count, level);
return;
}
if (cmax >= 0 && count > cmax) {
throw_toomany_arguments(fn, cmax, level);
throw_toomany_arguments_nr(fn, cmax, level);
return;
}
assert(false);
+4 -2
Ver Arquivo
@@ -415,14 +415,16 @@ Object create_object(CStrRef s, const Array &params, bool init = true);
* - When level is 1, it's from system funcs that turn both into warnings
* - When level is 0, it's from user funcs that turn missing arg in warnings
*/
Variant throw_missing_arguments(const char *fn, int num, int level = 0);
Variant throw_missing_arguments(const char *fn, int expected, int got,
int level = 0);
Variant throw_toomany_arguments(const char *fn, int num, int level = 0);
Variant throw_wrong_arguments(const char *fn, int count, int cmin, int cmax,
int level = 0);
Variant throw_missing_typed_argument(const char *fn, const char *type, int arg);
Variant throw_assign_this();
void throw_missing_arguments_nr(const char *fn, int num, int level = 0)
void throw_missing_arguments_nr(const char *fn, int expected, int got,
int level = 0)
__attribute__((cold));
void throw_toomany_arguments_nr(const char *fn, int num, int level = 0)
__attribute__((cold));
+3 -1
Ver Arquivo
@@ -51,7 +51,9 @@ const char* const FUNCTION_NAME_MUST_BE_STRING =
const char* const METHOD_NAME_MUST_BE_STRING =
"Method name must be a string";
const char* const MISSING_ARGUMENT =
"Missing argument %d to %s()";
"%s() expects exactly 1 parameter, %d given";
const char* const MISSING_ARGUMENTS =
"%s() expects exactly %d parameters, %d given";
const char* const CANT_UNSET_STRING =
"Cannot unset string offsets";
const char* const OP_NOT_SUPPORTED_STRING =
+25 -25
Ver Arquivo
@@ -525,7 +525,7 @@ TypedValue* fg_array_map(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_map", count+1, 1);
throw_missing_arguments_nr("array_map", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -574,7 +574,7 @@ TypedValue* fg_array_merge_recursive(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_merge_recursive", count+1, 1);
throw_missing_arguments_nr("array_merge_recursive", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -623,7 +623,7 @@ TypedValue* fg_array_merge(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_merge", count+1, 1);
throw_missing_arguments_nr("array_merge", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -672,7 +672,7 @@ TypedValue* fg_array_replace_recursive(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_replace_recursive", count+1, 1);
throw_missing_arguments_nr("array_replace_recursive", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -721,7 +721,7 @@ TypedValue* fg_array_replace(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_replace", count+1, 1);
throw_missing_arguments_nr("array_replace", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -769,7 +769,7 @@ TypedValue* fg_array_multisort(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_multisort", count+1, 1);
throw_missing_arguments_nr("array_multisort", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -939,7 +939,7 @@ TypedValue* fg_array_push(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_push", count+1, 1);
throw_missing_arguments_nr("array_push", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1414,7 +1414,7 @@ TypedValue* fg_array_unshift(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_unshift", count+1, 1);
throw_missing_arguments_nr("array_unshift", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1568,7 +1568,7 @@ TypedValue* fg_compact(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("compact", count+1, 1);
throw_missing_arguments_nr("compact", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2213,7 +2213,7 @@ TypedValue* fg_array_diff(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_diff", count+1, 1);
throw_missing_arguments_nr("array_diff", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2264,7 +2264,7 @@ TypedValue* fg_array_udiff(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_udiff", count+1, 1);
throw_missing_arguments_nr("array_udiff", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2314,7 +2314,7 @@ TypedValue* fg_array_diff_assoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_diff_assoc", count+1, 1);
throw_missing_arguments_nr("array_diff_assoc", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2365,7 +2365,7 @@ TypedValue* fg_array_diff_uassoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_diff_uassoc", count+1, 1);
throw_missing_arguments_nr("array_diff_uassoc", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2416,7 +2416,7 @@ TypedValue* fg_array_udiff_assoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_udiff_assoc", count+1, 1);
throw_missing_arguments_nr("array_udiff_assoc", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2468,7 +2468,7 @@ TypedValue* fg_array_udiff_uassoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_udiff_uassoc", count+1, 1);
throw_missing_arguments_nr("array_udiff_uassoc", 4, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2518,7 +2518,7 @@ TypedValue* fg_array_diff_key(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_diff_key", count+1, 1);
throw_missing_arguments_nr("array_diff_key", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2569,7 +2569,7 @@ TypedValue* fg_array_diff_ukey(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_diff_ukey", count+1, 1);
throw_missing_arguments_nr("array_diff_ukey", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2619,7 +2619,7 @@ TypedValue* fg_array_intersect(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_intersect", count+1, 1);
throw_missing_arguments_nr("array_intersect", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2670,7 +2670,7 @@ TypedValue* fg_array_uintersect(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_uintersect", count+1, 1);
throw_missing_arguments_nr("array_uintersect", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2720,7 +2720,7 @@ TypedValue* fg_array_intersect_assoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_intersect_assoc", count+1, 1);
throw_missing_arguments_nr("array_intersect_assoc", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2771,7 +2771,7 @@ TypedValue* fg_array_intersect_uassoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_intersect_uassoc", count+1, 1);
throw_missing_arguments_nr("array_intersect_uassoc", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2822,7 +2822,7 @@ TypedValue* fg_array_uintersect_assoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_uintersect_assoc", count+1, 1);
throw_missing_arguments_nr("array_uintersect_assoc", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2874,7 +2874,7 @@ TypedValue* fg_array_uintersect_uassoc(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_uintersect_uassoc", count+1, 1);
throw_missing_arguments_nr("array_uintersect_uassoc", 4, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2924,7 +2924,7 @@ TypedValue* fg_array_intersect_key(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_intersect_key", count+1, 1);
throw_missing_arguments_nr("array_intersect_key", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -2975,7 +2975,7 @@ TypedValue* fg_array_intersect_ukey(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("array_intersect_ukey", count+1, 1);
throw_missing_arguments_nr("array_intersect_ukey", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -893,7 +893,7 @@ TypedValue* fg_call_user_method(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("call_user_method", count+1, 1);
throw_missing_arguments_nr("call_user_method", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+7 -7
Ver Arquivo
@@ -558,7 +558,7 @@ TypedValue* tg_21DebuggerClientCmdUser_print(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::print", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::print", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::print");
@@ -640,7 +640,7 @@ TypedValue* tg_21DebuggerClientCmdUser_help(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::help", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::help", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::help");
@@ -722,7 +722,7 @@ TypedValue* tg_21DebuggerClientCmdUser_info(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::info", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::info", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::info");
@@ -804,7 +804,7 @@ TypedValue* tg_21DebuggerClientCmdUser_output(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::output", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::output", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::output");
@@ -886,7 +886,7 @@ TypedValue* tg_21DebuggerClientCmdUser_error(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::error", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::error", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::error");
@@ -1043,7 +1043,7 @@ TypedValue* tg_21DebuggerClientCmdUser_ask(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::ask", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::ask", 1, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::ask");
@@ -1241,7 +1241,7 @@ TypedValue* tg_21DebuggerClientCmdUser_helpCmds(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("DebuggerClientCmdUser::helpCmds", count+1, 1);
throw_missing_arguments_nr("DebuggerClientCmdUser::helpCmds", 2, count, 1);
}
} else {
throw_instance_method_fatal("DebuggerClientCmdUser::helpCmds");
+2 -2
Ver Arquivo
@@ -844,7 +844,7 @@ TypedValue* fg_fb_call_user_func_safe(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("fb_call_user_func_safe", count+1, 1);
throw_missing_arguments_nr("fb_call_user_func_safe", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -894,7 +894,7 @@ TypedValue* fg_fb_call_user_func_safe_return(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("fb_call_user_func_safe_return", count+1, 1);
throw_missing_arguments_nr("fb_call_user_func_safe_return", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+2 -2
Ver Arquivo
@@ -816,7 +816,7 @@ TypedValue* fg_fscanf(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("fscanf", count+1, 1);
throw_missing_arguments_nr("fscanf", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1080,7 +1080,7 @@ TypedValue* fg_fprintf(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("fprintf", count+1, 1);
throw_missing_arguments_nr("fprintf", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+8 -8
Ver Arquivo
@@ -208,7 +208,7 @@ TypedValue* fg_call_user_func(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("call_user_func", count+1, 1);
throw_missing_arguments_nr("call_user_func", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -311,7 +311,7 @@ TypedValue* fg_call_user_func_async(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("call_user_func_async", count+1, 1);
throw_missing_arguments_nr("call_user_func_async", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -641,7 +641,7 @@ TypedValue* fg_call_user_func_rpc(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("call_user_func_rpc", count+1, 1);
throw_missing_arguments_nr("call_user_func_rpc", 5, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -741,7 +741,7 @@ TypedValue* fg_forward_static_call(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("forward_static_call", count+1, 1);
throw_missing_arguments_nr("forward_static_call", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -996,7 +996,7 @@ TypedValue* fg_register_postsend_function(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("register_postsend_function", count+1, 1);
throw_missing_arguments_nr("register_postsend_function", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1044,7 +1044,7 @@ TypedValue* fg_register_shutdown_function(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("register_shutdown_function", count+1, 1);
throw_missing_arguments_nr("register_shutdown_function", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1092,7 +1092,7 @@ TypedValue* fg_register_cleanup_function(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("register_cleanup_function", count+1, 1);
throw_missing_arguments_nr("register_cleanup_function", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -1140,7 +1140,7 @@ TypedValue* fg_register_tick_function(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("register_tick_function", count+1, 1);
throw_missing_arguments_nr("register_tick_function", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+2 -2
Ver Arquivo
@@ -93,7 +93,7 @@ TypedValue* fg_min(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("min", count+1, 1);
throw_missing_arguments_nr("min", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -142,7 +142,7 @@ TypedValue* fg_max(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("max", count+1, 1);
throw_missing_arguments_nr("max", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -480,7 +480,7 @@ TypedValue* fg_mb_convert_variables(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("mb_convert_variables", count+1, 1);
throw_missing_arguments_nr("mb_convert_variables", 3, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -801,7 +801,7 @@ TypedValue* fg_pack(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("pack", count+1, 1);
throw_missing_arguments_nr("pack", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -1750,7 +1750,7 @@ TypedValue* tg_12PDOStatement_setfetchmode(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("PDOStatement::setfetchmode", count+1, 1);
throw_missing_arguments_nr("PDOStatement::setfetchmode", 1, count, 1);
}
} else {
throw_instance_method_fatal("PDOStatement::setfetchmode");
+1 -1
Ver Arquivo
@@ -838,7 +838,7 @@ TypedValue* fg_session_register(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("session_register", count+1, 1);
throw_missing_arguments_nr("session_register", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -272,7 +272,7 @@ TypedValue* tg_10SoapServer_setclass(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("SoapServer::setclass", count+1, 1);
throw_missing_arguments_nr("SoapServer::setclass", 1, count, 1);
}
} else {
throw_instance_method_fatal("SoapServer::setclass");
+4 -4
Ver Arquivo
@@ -3049,7 +3049,7 @@ TypedValue* fg_setlocale(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("setlocale", count+1, 1);
throw_missing_arguments_nr("setlocale", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -3213,7 +3213,7 @@ TypedValue* fg_printf(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("printf", count+1, 1);
throw_missing_arguments_nr("printf", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -3347,7 +3347,7 @@ TypedValue* fg_sprintf(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("sprintf", count+1, 1);
throw_missing_arguments_nr("sprintf", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
@@ -3487,7 +3487,7 @@ TypedValue* fg_sscanf(HPHP::VM::ActRec *ar) {
return &ar->m_r;
}
} else {
throw_missing_arguments_nr("sscanf", count+1, 1);
throw_missing_arguments_nr("sscanf", 2, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+1 -1
Ver Arquivo
@@ -483,7 +483,7 @@ TypedValue* fg_var_dump(HPHP::VM::ActRec *ar) {
memcpy(&ar->m_r, &rv, sizeof(TypedValue));
return &ar->m_r;
} else {
throw_missing_arguments_nr("var_dump", count+1, 1);
throw_missing_arguments_nr("var_dump", 1, count, 1);
}
rv.m_data.num = 0LL;
rv.m_type = KindOfNull;
+4 -2
Ver Arquivo
@@ -774,7 +774,8 @@ function phase2() {
$indent .= ' ';
if ($obj->isVarargs) {
fwrite($ext_hhvm_cpp, $indent . 'throw_missing_arguments_nr("' .
$obj->name . '", count+1, 1);' . "\n");
$obj->name . '", ' . $obj->minNumParams .
', count, 1);' . "\n");
} else {
if ($obj->minNumParams == 0) {
fwrite($ext_hhvm_cpp, $indent . 'throw_toomany_arguments_nr("' .
@@ -906,7 +907,8 @@ function phase2() {
$indent .= ' ';
if ($obj->isVarargs) {
fwrite($ext_hhvm_cpp, $indent . 'throw_missing_arguments_nr("' .
$obj->className . '::' . $obj->name . '", count+1, 1);' .
$obj->className . '::' . $obj->name . '", ' .
$obj->minNumParams . ', count, 1);' .
"\n");
} else {
if ($obj->minNumParams == 0) {
+6 -1
Ver Arquivo
@@ -1825,7 +1825,12 @@ bool VMExecutionContext::prepareFuncEntry(ActRec *ar,
for (int i = nargs; i < nparams; ++i) {
Offset dvInitializer = paramInfo[i].funcletOff();
if (dvInitializer == InvalidAbsoluteOffset) {
raise_warning(Strings::MISSING_ARGUMENT, i + 1, func->name()->data());
const char* name = func->name()->data();
if (nparams == 1) {
raise_warning(Strings::MISSING_ARGUMENT, name, i);
} else {
raise_warning(Strings::MISSING_ARGUMENTS, name, nparams, i);
}
}
}
}
+9 -4
Ver Arquivo
@@ -2237,8 +2237,12 @@ TranslatorX64::interceptPrologues(Func* func) {
}
}
static void raiseMissingArgument(int idx, const char* name) {
raise_warning(Strings::MISSING_ARGUMENT, idx, name);
static void raiseMissingArgument(const char* name, int expected, int got) {
if (expected == 1) {
raise_warning(Strings::MISSING_ARGUMENT, name, got);
} else {
raise_warning(Strings::MISSING_ARGUMENTS, name, expected, got);
}
}
SrcKey
@@ -2411,8 +2415,9 @@ TranslatorX64::emitPrologue(Func* func, int nPassed) {
if (!func->isBuiltin()) {
for (int i = nPassed; i < numParams; ++i) {
if (paramInfo[i].funcletOff() == InvalidAbsoluteOffset) {
emitImmReg(a, i + 1, argNumToRegName[0]);
emitImmReg(a, (intptr_t)func->name()->data(), argNumToRegName[1]);
emitImmReg(a, (intptr_t)func->name()->data(), argNumToRegName[0]);
emitImmReg(a, numParams, argNumToRegName[1]);
emitImmReg(a, i, argNumToRegName[2]);
emitCall(a, (TCA)raiseMissingArgument);
m_fixupMap.recordFixup(a.code.frontier, fixup);
}
+4 -4
Ver Arquivo
@@ -1,8 +1,8 @@
one
HipHop Warning: Missing argument 2 to two() in hphp/test/vm/not-enough-args.php on line 4
HipHop Warning: two() expects exactly 2 parameters, 1 given in hphp/test/vm/not-enough-args.php on line 4
two
HipHop Warning: Missing argument 2 to three() in hphp/test/vm/not-enough-args.php on line 5
HipHop Warning: Missing argument 3 to three() in hphp/test/vm/not-enough-args.php on line 5
HipHop Warning: three() expects exactly 3 parameters, 1 given in hphp/test/vm/not-enough-args.php on line 5
HipHop Warning: three() expects exactly 3 parameters, 2 given in hphp/test/vm/not-enough-args.php on line 5
three
one
HipHop Fatal error: Uncaught exception 'Exception' with message '2, Missing argument 2 to two()' in hphp/test/vm/not-enough-args.php:8\nStack trace:\n#0 hphp/test/vm/not-enough-args.php(4): error_handler()\n#1 hphp/test/vm/not-enough-args.php(17): two()\n#2 hphp/test/vm/not-enough-args.php(20): main()\n#3 {main}
HipHop Fatal error: Uncaught exception 'Exception' with message '2, two() expects exactly 2 parameters, 1 given' in hphp/test/vm/not-enough-args.php:8\nStack trace:\n#0 hphp/test/vm/not-enough-args.php(4): error_handler()\n#1 hphp/test/vm/not-enough-args.php(17): two()\n#2 hphp/test/vm/not-enough-args.php(20): main()\n#3 {main}
+5 -5
Ver Arquivo
@@ -11,11 +11,11 @@ T2::dubiousArgs 1
randObj: C
randObj: B
T1::dubiousArgs 2, 2
--HipHop Warning: Missing argument 1 to noSuchMethodBoyeee() in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: Missing argument 2 to noSuchMethodBoyeee() in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: Missing argument 3 to noSuchMethodBoyeee() in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: Missing argument 4 to noSuchMethodBoyeee() in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: Missing argument 5 to noSuchMethodBoyeee() in hphp/test/vm/poly-torture.php on line 41
--HipHop Warning: noSuchMethodBoyeee() expects exactly 5 parameters, 0 given in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: noSuchMethodBoyeee() expects exactly 5 parameters, 1 given in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: noSuchMethodBoyeee() expects exactly 5 parameters, 2 given in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: noSuchMethodBoyeee() expects exactly 5 parameters, 3 given in hphp/test/vm/poly-torture.php on line 41
HipHop Warning: noSuchMethodBoyeee() expects exactly 5 parameters, 4 given in hphp/test/vm/poly-torture.php on line 41
HipHop Notice: Undefined variable: d in hphp/test/vm/poly-torture.php on line 41
HipHop Notice: Undefined variable: e in hphp/test/vm/poly-torture.php on line 41
C also has this method with params:
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 3 for strncmp() in hphp/test/zend/bad/004.php on line %d
HipHop Warning: strncmp() expects exactly 3 parameters, 2 given in hphp/test/zend/bad/004.php on line %d
NULL
int(0)
HipHop Warning: Length must be greater than or equal to 0 in hphp/test/zend/bad/004.php on line %d
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 3 for strncasecmp() in hphp/test/zend/bad/006.php on line %d
HipHop Warning: strncasecmp() expects exactly 3 parameters, 1 given in hphp/test/zend/bad/006.php on line %d
NULL
HipHop Warning: Length must be greater than or equal to 0 in hphp/test/zend/bad/006.php on line %d
bool(false)
+2 -2
Ver Arquivo
@@ -1,6 +1,6 @@
HipHop Warning: Missing argument 2 for property_exists() in hphp/test/zend/bad/011.php on line %d
HipHop Warning: property_exists() expects exactly 2 parameters, 0 given in hphp/test/zend/bad/011.php on line %d
NULL
HipHop Warning: Missing argument 2 for property_exists() in hphp/test/zend/bad/011.php on line %d
HipHop Warning: property_exists() expects exactly 2 parameters, 1 given in hphp/test/zend/bad/011.php on line %d
NULL
bool(true)
bool(true)
+2 -2
Ver Arquivo
@@ -8,7 +8,7 @@ array(2) {
[1]=>
string(%d) "%s"
}
HipHop Warning: Missing argument 0 for get_included_files() in hphp/test/zend/bad/014.php on line %d
HipHop Warning: get_included_files() expects exactly 0 parameters, 2 given in hphp/test/zend/bad/014.php on line %d
NULL
array(2) {
[0]=>
@@ -16,7 +16,7 @@ array(2) {
[1]=>
string(%d) "%s"
}
HipHop Warning: Missing argument 0 for get_included_files() in hphp/test/zend/bad/014.php on line %d
HipHop Warning: get_included_files() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/014.php on line %d
NULL
array(2) {
[0]=>
+4 -4
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 1 for get_resource_type() in hphp/test/zend/bad/017.php on line %d
HipHop Warning: get_resource_type() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/017.php on line %d
NULL
HipHop Warning: get_resource_type() expects parameter 1 to be resource, string given in hphp/test/zend/bad/017.php on line %d
NULL
@@ -15,15 +15,15 @@ NULL
string(5) "array"
string(5) "array"
int(%d)
HipHop Warning: Missing argument 0 for get_defined_functions() in hphp/test/zend/bad/017.php on line %d
HipHop Warning: get_defined_functions() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/017.php on line %d
NULL
string(5) "array"
int(%d)
HipHop Warning: Missing argument 0 for get_declared_interfaces() in hphp/test/zend/bad/017.php on line %d
HipHop Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/017.php on line %d
NULL
string(5) "array"
int(%d)
HipHop Warning: Missing argument 1 for get_extension_funcs() in hphp/test/zend/bad/017.php on line %d
HipHop Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/017.php on line %d
NULL
bool(false)
string(5) "array"
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 1 for constant() in hphp/test/zend/bad/018.php on line %d
HipHop Warning: constant() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/018.php on line %d
NULL
HipHop Warning: constant() expects exactly 1 parameter, 2 given in hphp/test/zend/bad/018.php on line %d
NULL
+1 -1
Ver Arquivo
@@ -2,7 +2,7 @@ HipHop Warning: func_get_arg() expects exactly 1 parameter, 3 given in hphp/test
NULL
HipHop Warning: func_get_arg(): Called from the global scope - no function context in hphp/test/zend/bad/020.php on line %d
bool(false)
HipHop Warning: Missing argument 1 for func_get_arg() in hphp/test/zend/bad/020.php on line %d
HipHop Warning: func_get_arg() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/020.php on line %d
NULL
HipHop Warning: func_get_arg(): Argument 1 not passed to function in hphp/test/zend/bad/020.php on line %d
bool(false)
@@ -1,5 +1,5 @@
HipHop Warning: set_exception_handler() expects the argument (fo) to be a valid callback in hphp/test/zend/bad/exception_handler_004.php on line %d
HipHop Warning: set_exception_handler() expects the argument (::) to be a valid callback in hphp/test/zend/bad/exception_handler_004.php on line %d
HipHop Warning: Missing argument 1 for set_exception_handler() in hphp/test/zend/bad/exception_handler_004.php on line %d
HipHop Warning: set_exception_handler() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/exception_handler_004.php on line %d
HipHop Warning: set_exception_handler() expects exactly 1 parameter, 2 given in hphp/test/zend/bad/exception_handler_004.php on line %d
Done
@@ -5,7 +5,7 @@ HipHop Warning: function_exists() expects exactly 1 parameter, 2 given in hphp/t
NULL
Too few arguments
HipHop Warning: Missing argument 1 for function_exists() in hphp/test/zend/bad/function_exists_error.php on line %d
HipHop Warning: function_exists() expects exactly 1 parameter, 0 given in hphp/test/zend/bad/function_exists_error.php on line %d
NULL
===Done===
@@ -1,7 +1,7 @@
*** Testing get_defined_functions() : error conditions ***
-- Testing get_defined_functions() function with more than expected no. of arguments --
HipHop Warning: Missing argument 0 for get_defined_functions() in hphp/test/zend/bad/get_defined_functions_error.php on line %d
HipHop Warning: get_defined_functions() expects exactly 0 parameters, 1 given in hphp/test/zend/bad/get_defined_functions_error.php on line %d
NULL
===Done===
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 2 for strcasecmp() in hphp/test/zend/good/005.php on line 3
HipHop Warning: strcasecmp() expects exactly 2 parameters, 1 given in hphp/test/zend/good/005.php on line 3
NULL
int(0)
int(-3)
+1 -1
Ver Arquivo
@@ -1,4 +1,4 @@
HipHop Warning: Missing argument 1 for each() in hphp/test/zend/good/007.php on line 3
HipHop Warning: each() expects exactly 1 parameter, 0 given in hphp/test/zend/good/007.php on line 3
NULL
HipHop Warning: Invalid operand type was used: expecting an array in hphp/test/zend/good/007.php on line 5
NULL
-4
Ver Arquivo
@@ -19,10 +19,6 @@ bad_tests = (
errors = (
# generic inconsistencies
('Variable passed to ([^\s]+)\(\) is not an array or object', 'Invalid operand type was used: expecting an array'),
# I can't do math with backreferences so write them out
('([^\s]+)\(\) expects exactly 1 parameter, 0 given', r'Missing argument 1 for \1()'),
('([^\s]+)\(\) expects exactly (\d+) parameters, \d+ given', r'Missing argument \2 for \1()'),
)
parser = argparse.ArgumentParser()