}
?>
--EXPECT--
-array_map(): Argument #1 ($callback) must be a valid callback, function "%n" not found or invalid function name
-array_map(): Argument #1 ($callback) must be a valid callback, function "%n %i" not found or invalid function name
-array_map(): Argument #1 ($callback) must be a valid callback, function "%n %i aoeu %f aoeu %p" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "%n %i aoeu %f aoeu %p" not found or invalid function name
}
?>
--EXPECT--
-array_map(): Argument #1 ($callback) must be a valid callback, function "0000000000000000000000000000000000" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "0000000000000000000000000000000000" not found or invalid function name
*** Trying Ord With Integer
*** Caught ord(): Argument #1 ($character) must be of type string, int given
*** Trying Array Map With Invalid Callback
-*** Caught array_map(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
+*** Caught array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object
*** Trying Strlen With Float
*** Caught strlen(): Argument #1 ($str) must be of type string, float given
case ZPP_ERROR_WRONG_CALLBACK:
zend_wrong_callback_error(num, name);
break;
+ case ZPP_ERROR_WRONG_CALLBACK_OR_NULL:
+ zend_wrong_callback_or_null_error(num, name);
+ break;
case ZPP_ERROR_WRONG_CLASS:
zend_wrong_parameter_class_error(num, name, arg);
break;
}
/* }}} */
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_or_null_error(uint32_t num, char *error) /* {{{ */
+{
+ if (EG(exception)) {
+ return;
+ }
+
+ zend_argument_type_error(num, "must be a valid callback or null, %s", error);
+ efree(error);
+}
+/* }}} */
+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_unexpected_extra_named_error(void)
{
const char *space;
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_error(uint32_t num, const char *name, zval *arg);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_class_or_string_or_null_error(uint32_t num, const char *name, zval *arg);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_error(uint32_t num, char *error);
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_callback_or_null_error(uint32_t num, char *error);
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_unexpected_extra_named_error(void);
ZEND_API ZEND_COLD void zend_argument_error(zend_class_entry *error_ce, uint32_t arg_num, const char *format, ...);
ZEND_API ZEND_COLD void zend_argument_type_error(uint32_t arg_num, const char *format, ...);
#define ZPP_ERROR_WRONG_ARG 9
#define ZPP_ERROR_WRONG_COUNT 10
#define ZPP_ERROR_UNEXPECTED_EXTRA_NAMED 11
+#define ZPP_ERROR_WRONG_CALLBACK_OR_NULL 12
#define ZEND_PARSE_PARAMETERS_START_EX(flags, min_num_args, max_num_args) do { \
const int _flags = (flags); \
_expected_type = check_null ? Z_EXPECTED_FUNC_OR_NULL : Z_EXPECTED_FUNC; \
_error_code = ZPP_ERROR_WRONG_ARG; \
} else { \
- _error_code = ZPP_ERROR_WRONG_CALLBACK; \
+ _error_code = check_null ? ZPP_ERROR_WRONG_CALLBACK_OR_NULL : ZPP_ERROR_WRONG_CALLBACK; \
} \
break; \
} \
%stestclass.class.inc
bool(true)
===NOFUNCTION===
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, function "unavailable_autoload_function" not found or invalid function name
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, function "unavailable_autoload_function" not found or invalid function name
?>
--EXPECT--
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method MyAutoLoader::autoLoad() cannot be called statically
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::autoLoad() cannot be called statically
MyAutoLoader::autoLoad(TestClass)
MyAutoLoader::autoThrow(TestClass)
Exception: Unavailable
?>
--EXPECTF--
string(22) "MyAutoLoader::notExist"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, class MyAutoLoader does not have a method "notExist"
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
string(22) "MyAutoLoader::noAccess"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, cannot access protected method MyAutoLoader::noAccess()
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
string(22) "MyAutoLoader::autoLoad"
ok
string(22) "MyAutoLoader::dynaLoad"
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
array(2) {
[0]=>
[1]=>
string(8) "notExist"
}
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, class MyAutoLoader does not have a method "notExist"
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
array(2) {
[0]=>
[1]=>
string(8) "noAccess"
}
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, cannot access protected method MyAutoLoader::noAccess()
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
array(2) {
[0]=>
[1]=>
string(8) "dynaLoad"
}
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
array(2) {
[0]=>
[1]=>
string(8) "notExist"
}
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, class MyAutoLoader does not have a method "notExist"
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, class MyAutoLoader does not have a method "notExist"
array(2) {
[0]=>
[1]=>
string(8) "noAccess"
}
-spl_autoload_register(): Argument #1 ($callback) must be a valid callback, cannot access protected method MyAutoLoader::noAccess()
+spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method MyAutoLoader::noAccess()
array(2) {
[0]=>
int(0)
====2====
string(22) "MyAutoLoader::dynaLoad"
-TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
int(0)
====3====
array(2) {
[1]=>
string(8) "dynaLoad"
}
-TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback, non-static method MyAutoLoader::dynaLoad() cannot be called statically
+TypeError: spl_autoload_register(): Argument #1 ($callback) must be a valid callback or null, non-static method MyAutoLoader::dynaLoad() cannot be called statically
int(0)
====5====
array(2) {
[5]=>
int(1000)
}
-array_filter(): Argument #2 ($callback) must be a valid callback, function "echo" not found or invalid function name
-array_filter(): Argument #2 ($callback) must be a valid callback, function "exit" not found or invalid function name
+array_filter(): Argument #2 ($callback) must be a valid callback or null, function "echo" not found or invalid function name
+array_filter(): Argument #2 ($callback) must be a valid callback or null, function "exit" not found or invalid function name
Done
-- simple class with private variable and method --
SimpleClassPri::add
-array_map(): Argument #1 ($callback) must be a valid callback, cannot access private method SimpleClassPri::add()
+array_map(): Argument #1 ($callback) must be a valid callback or null, cannot access private method SimpleClassPri::add()
-- simple class with protected variable and method --
SimpleClassPro::mul
-array_map(): Argument #1 ($callback) must be a valid callback, cannot access protected method SimpleClassPro::mul()
+array_map(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method SimpleClassPro::mul()
-- class without members --
EmptyClass
-array_map(): Argument #1 ($callback) must be a valid callback, array must have exactly two members
+array_map(): Argument #1 ($callback) must be a valid callback or null, array must have exactly two members
-- abstract class --
ChildClass::emptyFunction
int(4)
}
StaticClass::cube
-array_map(): Argument #1 ($callback) must be a valid callback, cannot access private method StaticClass::cube()
+array_map(): Argument #1 ($callback) must be a valid callback or null, cannot access private method StaticClass::cube()
StaticClass::retVal
-array_map(): Argument #1 ($callback) must be a valid callback, cannot access protected method StaticClass::retVal()
+array_map(): Argument #1 ($callback) must be a valid callback or null, cannot access protected method StaticClass::retVal()
-- class implementing an interface --
InterClass::square
array(2) {
--EXPECT--
*** Testing array_map() : with non-existent class and method ***
-- with non-existent class --
-array_map(): Argument #1 ($callback) must be a valid callback, class "non-existent" not found
+array_map(): Argument #1 ($callback) must be a valid callback or null, class "non-existent" not found
-- with existent class and non-existent method --
-array_map(): Argument #1 ($callback) must be a valid callback, class SimpleClass does not have a method "non-existent"
+array_map(): Argument #1 ($callback) must be a valid callback or null, class SimpleClass does not have a method "non-existent"
Done
int(7)
}
-- accessing child method from parent class --
-array_map(): Argument #1 ($callback) must be a valid callback, class ParentClass does not have a method "staticChild"
+array_map(): Argument #1 ($callback) must be a valid callback or null, class ParentClass does not have a method "staticChild"
-- accessing parent method using child class object --
array(3) {
[0]=>
int(7)
}
-- accessing child method using parent class object --
-array_map(): Argument #1 ($callback) must be a valid callback, class ParentClass does not have a method "staticChild"
+array_map(): Argument #1 ($callback) must be a valid callback or null, class ParentClass does not have a method "staticChild"
Done
-- with built-in function 'pow' and one parameter --
pow() expects exactly 2 arguments, 1 given
-- with language construct --
-array_map(): Argument #1 ($callback) must be a valid callback, function "echo" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "echo" not found or invalid function name
Done
int(2)
}
-- with empty string --
-array_map(): Argument #1 ($callback) must be a valid callback, function "" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "" not found or invalid function name
-- with empty array --
-array_map(): Argument #1 ($callback) must be a valid callback, array must have exactly two members
+array_map(): Argument #1 ($callback) must be a valid callback or null, array must have exactly two members
Done
?>
--EXPECT--
*** Testing array_map() : non existent 'callback' function ***
-array_map(): Argument #1 ($callback) must be a valid callback, function "non_existent" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "non_existent" not found or invalid function name
Done
--EXPECT--
*** Testing array_map() : non-permmited built-in functions ***
-- Iteration 1 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "echo" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "echo" not found or invalid function name
-- Iteration 2 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "array" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "array" not found or invalid function name
-- Iteration 3 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "empty" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "empty" not found or invalid function name
-- Iteration 4 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "eval" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "eval" not found or invalid function name
-- Iteration 5 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "exit" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "exit" not found or invalid function name
-- Iteration 6 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "isset" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "isset" not found or invalid function name
-- Iteration 7 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "list" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "list" not found or invalid function name
-- Iteration 8 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "print" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "print" not found or invalid function name
Done
*** Testing array_map() : unexpected values for 'callback' argument ***
-- Iteration 1 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 2 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 3 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 4 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 5 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 6 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 7 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 8 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 9 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 10 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 11 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 12 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 13 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 14 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "" not found or invalid function name
-- Iteration 15 --
-array_map(): Argument #1 ($callback) must be a valid callback, function "" not found or invalid function name
+array_map(): Argument #1 ($callback) must be a valid callback or null, function "" not found or invalid function name
-- Iteration 16 --
-array_map(): Argument #1 ($callback) must be a valid callback, array must have exactly two members
+array_map(): Argument #1 ($callback) must be a valid callback or null, array must have exactly two members
-- Iteration 17 --
-array_map(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
+array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object
-- Iteration 18 --
-array_map(): Argument #1 ($callback) must be a valid callback, first array member is not a valid class name or object
+array_map(): Argument #1 ($callback) must be a valid callback or null, first array member is not a valid class name or object
-- Iteration 19 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
-- Iteration 20 --
-array_map(): Argument #1 ($callback) must be a valid callback, no array or string given
+array_map(): Argument #1 ($callback) must be a valid callback or null, no array or string given
Done