Let normal zpp throw ArgumentCountErrors.
GC_ADDREF(aht);
if (!use_arg) {
+ if (zend_parse_parameters_none() == FAILURE) {
+ goto exit;
+ }
+
intern->nApplyCount++;
call_user_function(EG(function_table), NULL, &function_name, return_value, 1, params);
intern->nApplyCount--;
} else if (use_arg == SPL_ARRAY_METHOD_MAY_USER_ARG) {
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
- zend_throw_exception(spl_ce_BadMethodCallException, "Function expects one argument at most", 0);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
goto exit;
}
if (arg) {
call_user_function(EG(function_table), NULL, &function_name, return_value, arg ? 2 : 1, params);
intern->nApplyCount--;
} else {
- if (ZEND_NUM_ARGS() != 1 || zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
- zend_throw_exception(spl_ce_BadMethodCallException, "Function expects exactly one argument", 0);
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
goto exit;
}
ZVAL_COPY_VALUE(¶ms[1], arg);
$ao2 = new ArrayObject(array('a'=>'boo10','b'=>'boo1','c'=>'boo2','d'=>'boo22','e'=>'BOO5'));
var_dump($ao1->natcasesort());
var_dump($ao1);
-var_dump($ao2->natcasesort('blah'));
+try {
+ var_dump($ao2->natcasesort('blah'));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
?>
--EXPECT--
string(5) "boo22"
}
}
-bool(true)
+ArrayObject::natcasesort() expects exactly 0 parameters, 1 given
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(5) {
+ ["a"]=>
+ string(5) "boo10"
["b"]=>
string(4) "boo1"
["c"]=>
string(4) "boo2"
- ["e"]=>
- string(4) "BOO5"
- ["a"]=>
- string(5) "boo10"
["d"]=>
string(5) "boo22"
+ ["e"]=>
+ string(4) "BOO5"
}
}
$ao2 = new ArrayObject(array('a'=>'boo10','b'=>'boo1','c'=>'boo2','d'=>'boo22','e'=>'BOO5'));
var_dump($ao1->natsort());
var_dump($ao1);
-var_dump($ao2->natsort('blah'));
+try {
+ var_dump($ao2->natsort('blah'));
+} catch (ArgumentCountError $e) {
+ echo $e->getMessage(), "\n";
+}
var_dump($ao2);
?>
--EXPECT--
string(5) "boo22"
}
}
-bool(true)
+ArrayObject::natsort() expects exactly 0 parameters, 1 given
object(ArrayObject)#2 (1) {
["storage":"ArrayObject":private]=>
array(5) {
- ["e"]=>
- string(4) "BOO5"
+ ["a"]=>
+ string(5) "boo10"
["b"]=>
string(4) "boo1"
["c"]=>
string(4) "boo2"
- ["a"]=>
- string(5) "boo10"
["d"]=>
string(5) "boo22"
+ ["e"]=>
+ string(4) "BOO5"
}
}
try {
$ao->uasort();
-} catch (BadMethodCallException $e) {
+} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
try {
$ao->uasort(1,2);
-} catch (BadMethodCallException $e) {
+} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
-Function expects exactly one argument
-Function expects exactly one argument
+ArrayObject::uasort() expects exactly 1 parameter, 0 given
+ArrayObject::uasort() expects exactly 1 parameter, 2 given
try {
$ao->uksort();
-} catch (BadMethodCallException $e) {
+} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
try {
$ao->uksort(1,2);
-} catch (BadMethodCallException $e) {
+} catch (ArgumentCountError $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECT--
-Function expects exactly one argument
-Function expects exactly one argument
+ArrayObject::uksort() expects exactly 1 parameter, 0 given
+ArrayObject::uksort() expects exactly 1 parameter, 2 given