diff options
Diffstat (limited to 'Zend/tests')
27 files changed, 135 insertions, 199 deletions
diff --git a/Zend/tests/011.phpt b/Zend/tests/011.phpt index 7bcab0798f..d36ae80ae8 100644 --- a/Zend/tests/011.phpt +++ b/Zend/tests/011.phpt @@ -23,8 +23,6 @@ class bar extends foo { } } -var_dump(property_exists()); -var_dump(property_exists("")); var_dump(property_exists("foo","pp1")); var_dump(property_exists("foo","pp2")); var_dump(property_exists("foo","pp3")); @@ -53,11 +51,6 @@ $bar->test(); echo "Done\n"; ?> --EXPECTF-- -Warning: property_exists() expects exactly 2 parameters, 0 given in %s on line %d -NULL - -Warning: property_exists() expects exactly 2 parameters, 1 given in %s on line %d -NULL bool(true) bool(true) bool(true) diff --git a/Zend/tests/012.phpt b/Zend/tests/012.phpt index 40f68e9794..c238229066 100644 --- a/Zend/tests/012.phpt +++ b/Zend/tests/012.phpt @@ -6,10 +6,8 @@ class_exists() tests class foo { } -var_dump(class_exists()); var_dump(class_exists("qwerty")); var_dump(class_exists("")); -var_dump(class_exists(array())); var_dump(class_exists("test", false)); var_dump(class_exists("foo", false)); var_dump(class_exists("foo")); @@ -18,14 +16,9 @@ var_dump(class_exists("stdClass")); echo "Done\n"; ?> ---EXPECTF-- -Warning: class_exists() expects at least 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) bool(false) - -Warning: class_exists() expects parameter 1 to be string, array given in %s on line %d -NULL bool(false) bool(true) bool(true) diff --git a/Zend/tests/013.phpt b/Zend/tests/013.phpt index aec10e53f1..fd8320b536 100644 --- a/Zend/tests/013.phpt +++ b/Zend/tests/013.phpt @@ -6,10 +6,8 @@ interface_exists() tests interface foo { } -var_dump(interface_exists()); var_dump(interface_exists("qwerty")); var_dump(interface_exists("")); -var_dump(interface_exists(array())); var_dump(interface_exists("test", false)); var_dump(interface_exists("foo", false)); var_dump(interface_exists("foo")); @@ -18,14 +16,9 @@ var_dump(interface_exists("stdClass")); echo "Done\n"; ?> ---EXPECTF-- -Warning: interface_exists() expects at least 1 parameter, 0 given in %s on line %d -NULL +--EXPECT-- bool(false) bool(false) - -Warning: interface_exists() expects parameter 1 to be string, array given in %s on line %d -NULL bool(false) bool(true) bool(true) diff --git a/Zend/tests/014.phpt b/Zend/tests/014.phpt index 18037a99e3..2a5cca7c4d 100644 --- a/Zend/tests/014.phpt +++ b/Zend/tests/014.phpt @@ -8,13 +8,9 @@ var_dump(get_included_files()); include(dirname(__FILE__)."/014.inc"); var_dump(get_included_files()); -var_dump(get_included_files(1,1)); - include_once(dirname(__FILE__)."/014.inc"); var_dump(get_included_files()); -var_dump(get_included_files(1)); - include(dirname(__FILE__)."/014.inc"); var_dump(get_included_files()); @@ -31,18 +27,12 @@ array(2) { [1]=> string(%d) "%s" } - -Warning: get_included_files() expects exactly 0 parameters, 2 given in %s on line %d -NULL array(2) { [0]=> string(%d) "%s" [1]=> string(%d) "%s" } - -Warning: get_included_files() expects exactly 0 parameters, 1 given in %s on line %d -NULL array(2) { [0]=> string(%d) "%s" diff --git a/Zend/tests/015.phpt b/Zend/tests/015.phpt index ccf5e4ddb0..deea89d14d 100644 --- a/Zend/tests/015.phpt +++ b/Zend/tests/015.phpt @@ -3,9 +3,7 @@ trigger_error() tests --FILE-- <?php -var_dump(trigger_error()); var_dump(trigger_error("error")); -var_dump(trigger_error(array())); var_dump(trigger_error("error", -1)); var_dump(trigger_error("error", 0)); var_dump(trigger_error("error", E_USER_WARNING)); @@ -14,15 +12,9 @@ var_dump(trigger_error("error", E_USER_DEPRECATED)); echo "Done\n"; ?> --EXPECTF-- -Warning: trigger_error() expects at least 1 parameter, 0 given in %s on line %d -NULL - Notice: error in %s on line %d bool(true) -Warning: trigger_error() expects parameter 1 to be string, array given in %s on line %d -NULL - Warning: Invalid error type specified in %s on line %d bool(false) diff --git a/Zend/tests/017.phpt b/Zend/tests/017.phpt index ed1b2a38a5..619365cbce 100644 --- a/Zend/tests/017.phpt +++ b/Zend/tests/017.phpt @@ -3,8 +3,6 @@ builtin functions tests --FILE-- <?php -var_dump(get_resource_type()); -var_dump(get_resource_type("")); $fp = fopen(__FILE__, "r"); var_dump(get_resource_type($fp)); fclose($fp); @@ -14,11 +12,9 @@ var_dump(gettype(get_loaded_extensions())); var_dump(count(get_loaded_extensions())); var_dump(gettype(get_loaded_extensions(true))); var_dump(count(get_loaded_extensions(true))); -var_dump(get_loaded_extensions(true, true)); define("USER_CONSTANT", "test"); -var_dump(get_defined_constants(true, true)); var_dump(gettype(get_defined_constants(true))); var_dump(gettype(get_defined_constants())); var_dump(count(get_defined_constants())); @@ -29,11 +25,9 @@ function test () { var_dump(gettype(get_defined_functions())); var_dump(count(get_defined_functions())); -var_dump(get_declared_interfaces(true)); var_dump(gettype(get_declared_interfaces())); var_dump(count(get_declared_interfaces())); -var_dump(get_extension_funcs()); var_dump(get_extension_funcs(true)); var_dump(gettype(get_extension_funcs("standard"))); var_dump(count(get_extension_funcs("standard"))); @@ -44,36 +38,19 @@ var_dump(count(get_extension_funcs("zend"))); echo "Done\n"; ?> --EXPECTF-- -Warning: get_resource_type() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: get_resource_type() expects parameter 1 to be resource, string given in %s on line %d -NULL string(6) "stream" string(7) "Unknown" string(5) "array" int(%d) string(5) "array" int(%d) - -Warning: get_loaded_extensions() expects at most 1 parameter, 2 given in %s on line %d -NULL - -Warning: get_defined_constants() expects at most 1 parameter, 2 given in %s on line %d -NULL string(5) "array" string(5) "array" int(%d) string(5) "array" int(%d) - -Warning: get_declared_interfaces() expects exactly 0 parameters, 1 given in %s on line %d -NULL string(5) "array" int(%d) - -Warning: get_extension_funcs() expects exactly 1 parameter, 0 given in %s on line %d -NULL bool(false) string(5) "array" int(%d) diff --git a/Zend/tests/018.phpt b/Zend/tests/018.phpt index 5ced729fce..97e53b1050 100644 --- a/Zend/tests/018.phpt +++ b/Zend/tests/018.phpt @@ -3,12 +3,8 @@ constant() tests --FILE-- <?php -var_dump(constant()); -var_dump(constant("", "")); var_dump(constant("")); -var_dump(constant(array())); - define("TEST_CONST", 1); var_dump(constant("TEST_CONST")); @@ -18,17 +14,8 @@ var_dump(constant("TEST_CONST2")); echo "Done\n"; ?> --EXPECTF-- -Warning: constant() expects exactly 1 parameter, 0 given in %s on line %d -NULL - -Warning: constant() expects exactly 1 parameter, 2 given in %s on line %d -NULL - Warning: constant(): Couldn't find constant in %s on line %d NULL - -Warning: constant() expects parameter 1 to be string, array given in %s on line %d -NULL int(1) string(4) "test" Done diff --git a/Zend/tests/020.phpt b/Zend/tests/020.phpt index 1e2bcff387..efc221cb4f 100644 --- a/Zend/tests/020.phpt +++ b/Zend/tests/020.phpt @@ -3,9 +3,7 @@ func_get_arg() invalid usage --FILE-- <?php -var_dump(func_get_arg(1,2,3)); var_dump(func_get_arg(1)); -var_dump(func_get_arg()); function bar() { var_dump(func_get_arg(1)); @@ -20,15 +18,9 @@ foo(1,2); echo "Done\n"; ?> --EXPECTF-- -Warning: func_get_arg() expects exactly 1 parameter, 3 given in %s on line %d -NULL - Warning: func_get_arg(): Called from the global scope - no function context in %s on line %d bool(false) -Warning: func_get_arg() expects exactly 1 parameter, 0 given in %s on line %d -NULL - Warning: func_get_arg(): Argument 1 not passed to function in %s on line %d bool(false) Done diff --git a/Zend/tests/bug31720.phpt b/Zend/tests/bug31720.phpt index c4680a4789..9031dec030 100644 --- a/Zend/tests/bug31720.phpt +++ b/Zend/tests/bug31720.phpt @@ -4,11 +4,14 @@ Bug #31720 (Invalid object callbacks not caught in array_walk()) <?php $array = array('at least one element'); -array_walk($array, array($nonesuchvar,'show')); +try { + array_walk($array, array($nonesuchvar,'show')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --EXPECTF-- Notice: Undefined variable: nonesuchvar in %s on line %d - -Warning: array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object in %s on line %d +array_walk() expects parameter 2 to be a valid callback, first array member is not a valid class name or object ===DONE=== diff --git a/Zend/tests/bug45186.phpt b/Zend/tests/bug45186.phpt index 411c2ea072..1c25a86921 100644 --- a/Zend/tests/bug45186.phpt +++ b/Zend/tests/bug45186.phpt @@ -31,10 +31,14 @@ $x->test(); call_user_func(array('BAR','x')); call_user_func('BAR::www'); -call_user_func('self::y'); +try { + call_user_func('self::y'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- __call: string(3) "ABC" __call: @@ -50,5 +54,4 @@ string(1) "y" ok __callstatic: string(3) "www" - -Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186.php on line 31 +call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active diff --git a/Zend/tests/bug45186_2.phpt b/Zend/tests/bug45186_2.phpt index 7c813a909c..cb098136a0 100644 --- a/Zend/tests/bug45186_2.phpt +++ b/Zend/tests/bug45186_2.phpt @@ -26,11 +26,19 @@ $x = new bar; $x->test(); call_user_func(array('BAR','x')); -call_user_func('BAR::www'); -call_user_func('self::y'); +try { + call_user_func('BAR::www'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func('self::y'); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- __call: string(3) "ABC" __call: @@ -44,7 +52,5 @@ string(1) "y" __call: string(1) "y" ok - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www' in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active in %sbug45186_2.php on line 27 +call_user_func() expects parameter 1 to be a valid callback, class 'bar' does not have a method 'www' +call_user_func() expects parameter 1 to be a valid callback, cannot access self:: when no class scope is active diff --git a/Zend/tests/bug46106.phpt b/Zend/tests/bug46106.phpt index f18c25a6c2..b0e769e05a 100644 --- a/Zend/tests/bug46106.phpt +++ b/Zend/tests/bug46106.phpt @@ -15,8 +15,13 @@ function test($x) { } $x = new ReflectionFunction('str_pad'); -test($x); +try { + test($x); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> DONE --EXPECT-- +str_pad() expects at least 2 parameters, 1 given DONE diff --git a/Zend/tests/bug51827.phpt b/Zend/tests/bug51827.phpt index 0834749454..77bdc069c3 100644 --- a/Zend/tests/bug51827.phpt +++ b/Zend/tests/bug51827.phpt @@ -16,4 +16,8 @@ register_shutdown_function('exploDe'); --EXPECTF-- int(1) -Warning: explode() expects at least 2 parameters, 0 given in Unknown on line %d +Fatal error: Uncaught ArgumentCountError: explode() expects at least 2 parameters, 0 given in [no active file]:0 +Stack trace: +#0 [internal function]: explode() +#1 {main} + thrown in [no active file] on line 0 diff --git a/Zend/tests/bug70895.phpt b/Zend/tests/bug70895.phpt index 896bf00a7b..71ff19a0b5 100644 --- a/Zend/tests/bug70895.phpt +++ b/Zend/tests/bug70895.phpt @@ -3,13 +3,23 @@ Bug #70895 null ptr deref and segfault with crafted callable --FILE-- <?php -array_map("%n", 0); -array_map("%n %i", 0); -array_map("%n %i aoeu %f aoeu %p", 0); +try { + array_map("%n", 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map("%n %i", 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + array_map("%n %i aoeu %f aoeu %p", 0); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTREGEX-- -Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n' not found or invalid function name in .+ - -Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name in .+ - -Warning: array_map\(\) expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name in .+bug70895.php on line \d+ +--EXPECT-- +array_map() expects parameter 1 to be a valid callback, function '%n' not found or invalid function name +array_map() expects parameter 1 to be a valid callback, function '%n %i' not found or invalid function name +array_map() expects parameter 1 to be a valid callback, function '%n %i aoeu %f aoeu %p' not found or invalid function name diff --git a/Zend/tests/bug70898.phpt b/Zend/tests/bug70898.phpt index e31ee894bf..fa6e96d83f 100644 --- a/Zend/tests/bug70898.phpt +++ b/Zend/tests/bug70898.phpt @@ -2,21 +2,15 @@ Bug #70895 null ptr deref and segfault with crafted callable --FILE-- <?php - function m($f,$a){ - return array_map($f,0); - } +function m($f,$a){ + return array_map($f,0); +} - echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",(""))))))); +try { + echo implode(m("",m("",m("",m("",m("0000000000000000000000000000000000",(""))))))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name in %sbug70898.php on line %d - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d - -Warning: array_map() expects parameter 1 to be a valid callback, function '' not found or invalid function name in %sbug70898.php on line %d - -Warning: implode(): Argument must be an array in %sbug70898.php on line %d +--EXPECT-- +array_map() expects parameter 1 to be a valid callback, function '0000000000000000000000000000000000' not found or invalid function name diff --git a/Zend/tests/bug73338.phpt b/Zend/tests/bug73338.phpt index df4c3b66e4..816a526445 100644 --- a/Zend/tests/bug73338.phpt +++ b/Zend/tests/bug73338.phpt @@ -14,5 +14,6 @@ try { (function() { call_user_func("fail"); })(); } catch (Error $e) {} try { [new class { static function foo() {} function __destruct () { throw new Error; } }, "foo"](); } catch (Error $e) {} ?> ---EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, no array or string given in %s on line %d +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/tests/call_user_func_001.phpt b/Zend/tests/call_user_func_001.phpt index 15d0aec263..a6e43f3060 100644 --- a/Zend/tests/call_user_func_001.phpt +++ b/Zend/tests/call_user_func_001.phpt @@ -22,14 +22,20 @@ namespace testing { call_user_func(__NAMESPACE__ .'\foobar', 'foobar'); $class = __NAMESPACE__ .'\foo'; - call_user_func(array(new $class, 'priv'), 'foobar'); - call_user_func(array(new $class, 'prot'), 'foobar'); + try { + call_user_func(array(new $class, 'priv'), 'foobar'); + } catch (\TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + call_user_func(array(new $class, 'prot'), 'foobar'); + } catch (\TypeError $e) { + echo $e->getMessage(), "\n"; + } } ?> ---EXPECTF-- +--EXPECT-- string(6) "foobar" - -Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, cannot access private method testing\foo::priv() +call_user_func() expects parameter 1 to be a valid callback, cannot access protected method testing\foo::prot() diff --git a/Zend/tests/call_user_func_002.phpt b/Zend/tests/call_user_func_002.phpt index 454c6fda96..9d007a8af3 100644 --- a/Zend/tests/call_user_func_002.phpt +++ b/Zend/tests/call_user_func_002.phpt @@ -4,26 +4,38 @@ Testing call_user_func() with autoload and passing invalid params <?php spl_autoload_register(function ($class) { - var_dump($class); + var_dump($class); }); -call_user_func(array('foo', 'bar')); -call_user_func(array('', 'bar')); -call_user_func(array($foo, 'bar')); -call_user_func(array($foo, '')); +try { + call_user_func(array('foo', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array('', 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array($foo, 'bar')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + call_user_func(array($foo, '')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --EXPECTF-- string(3) "foo" - -Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, class '' not found in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, class 'foo' not found +call_user_func() expects parameter 1 to be a valid callback, class '' not found Notice: Undefined variable: foo in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object Notice: Undefined variable: foo in %s on line %d - -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object diff --git a/Zend/tests/class_exists_002.phpt b/Zend/tests/class_exists_002.phpt index ebe04575af..5e5df1d371 100644 --- a/Zend/tests/class_exists_002.phpt +++ b/Zend/tests/class_exists_002.phpt @@ -12,15 +12,11 @@ var_dump(class_exists(NULL)); var_dump(class_exists('FOO')); var_dump(class_exists('bar')); var_dump(class_exists(1)); -var_dump(class_exists(new stdClass)); ?> ---EXPECTF-- +--EXPECT-- bool(false) bool(false) bool(true) bool(false) bool(false) - -Warning: class_exists() expects parameter 1 to be string, object given in %s on line %d -NULL diff --git a/Zend/tests/closure_040.phpt b/Zend/tests/closure_040.phpt index 231ab4081c..531ecb271a 100644 --- a/Zend/tests/closure_040.phpt +++ b/Zend/tests/closure_040.phpt @@ -25,9 +25,6 @@ $ca = $a->getIncrementor(); $cas = $a->getStaticIncrementor(); $ca->bindTo($a, array()); -$ca->bindTo(array(), 'A'); -$ca->bindTo($a, array(), ""); -$ca->bindTo(); $cas->bindTo($a, 'A'); ?> @@ -36,10 +33,4 @@ Notice: Array to string conversion in %s on line %d Warning: Class 'Array' not found in %s on line %d -Warning: Closure::bindTo() expects parameter 1 to be object, array given in %s on line 25 - -Warning: Closure::bindTo() expects at most 2 parameters, 3 given in %s on line %d - -Warning: Closure::bindTo() expects at least 1 parameter, 0 given in %s on line %d - Warning: Cannot bind an instance to a static closure in %s on line %d diff --git a/Zend/tests/error_reporting10.phpt b/Zend/tests/error_reporting10.phpt index 8b0c7b9923..c18c04d8f0 100644 --- a/Zend/tests/error_reporting10.phpt +++ b/Zend/tests/error_reporting10.phpt @@ -8,7 +8,6 @@ error_reporting(E_ALL); function make_exception() { @$blah; - str_replace(); error_reporting(0); throw new Exception(); } diff --git a/Zend/tests/exception_handler_004.phpt b/Zend/tests/exception_handler_004.phpt index 69a4136b08..6552141b73 100644 --- a/Zend/tests/exception_handler_004.phpt +++ b/Zend/tests/exception_handler_004.phpt @@ -5,8 +5,6 @@ exception handler tests - 4 set_exception_handler("fo"); set_exception_handler(array("", "")); -set_exception_handler(); -set_exception_handler("foo", "bar"); echo "Done\n"; ?> @@ -14,8 +12,4 @@ echo "Done\n"; Warning: set_exception_handler() expects the argument (fo) to be a valid callback in %s on line %d Warning: set_exception_handler() expects the argument (::) to be a valid callback in %s on line %d - -Warning: set_exception_handler() expects exactly 1 parameter, 0 given in %s on line %d - -Warning: set_exception_handler() expects exactly 1 parameter, 2 given in %s on line %d Done diff --git a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt index a8ba71c0bf..5c0770ff65 100644 --- a/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt +++ b/Zend/tests/function_arguments/argument_count_incorrect_internal.phpt @@ -2,9 +2,10 @@ Call internal function with incorrect number of arguments --FILE-- <?php -substr("foo"); -array_diff([]); ---EXPECTF-- -Warning: substr() expects at least 2 parameters, 1 given in %s - -Warning: array_diff(): at least 2 parameters are required, 1 given in %s +try { + substr("foo"); +} catch (ArgumentCountError $e) { + echo $e->getMessage(), "\n"; +} +--EXPECT-- +substr() expects at least 2 parameters, 1 given diff --git a/Zend/tests/interface_exists_001.phpt b/Zend/tests/interface_exists_001.phpt index ab20dd20ea..84e9c6df1e 100644 --- a/Zend/tests/interface_exists_001.phpt +++ b/Zend/tests/interface_exists_001.phpt @@ -9,13 +9,9 @@ interface foo { var_dump(interface_exists('foo')); var_dump(interface_exists(1)); var_dump(interface_exists(NULL)); -var_dump(interface_exists(new stdClass)); ?> ---EXPECTF-- +--EXPECT-- bool(true) bool(false) bool(false) - -Warning: interface_exists() expects parameter 1 to be string, object given in %s on line %d -NULL diff --git a/Zend/tests/methods-on-non-objects-call-user-func.phpt b/Zend/tests/methods-on-non-objects-call-user-func.phpt index 027aa64c20..63884abc79 100644 --- a/Zend/tests/methods-on-non-objects-call-user-func.phpt +++ b/Zend/tests/methods-on-non-objects-call-user-func.phpt @@ -2,11 +2,12 @@ call_user_func() in combination with "Call to a member function method() on a non-object" --FILE-- <?php -$comparator= null; -var_dump(call_user_func([$comparator, 'compare'], 1, 2)); -echo "Alive\n"; +$comparator = null; +try { + var_dump(call_user_func([$comparator, 'compare'], 1, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in %s on line %d -NULL -Alive +--EXPECT-- +call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object diff --git a/Zend/tests/trait_exists_001.phpt b/Zend/tests/trait_exists_001.phpt index 10ce3fa0cb..8a7c55d586 100644 --- a/Zend/tests/trait_exists_001.phpt +++ b/Zend/tests/trait_exists_001.phpt @@ -9,13 +9,9 @@ trait foo { var_dump(trait_exists('foo')); var_dump(trait_exists(1)); var_dump(trait_exists(NULL)); -var_dump(trait_exists(new stdClass)); ?> ---EXPECTF-- +--EXPECT-- bool(true) bool(false) bool(false) - -Warning: trait_exists() expects parameter 1 to be string, object given in %s on line %d -NULL diff --git a/Zend/tests/unexpected_ref_bug.phpt b/Zend/tests/unexpected_ref_bug.phpt index ba61ee582a..c7f66f05a0 100644 --- a/Zend/tests/unexpected_ref_bug.phpt +++ b/Zend/tests/unexpected_ref_bug.phpt @@ -2,16 +2,17 @@ Crash when function parameter modified via unexpected reference --FILE-- <?php -function my_errorhandler($errno,$errormsg) { - global $my_var; - $my_var = 0; - return true; +class Test { + public function __toString() { + global $my_var; + $my_var = 0; + return ","; + } } -set_error_handler("my_errorhandler"); $my_var = str_repeat("A",64); -$data = call_user_func_array("explode",array(new StdClass(), &$my_var)); +$data = call_user_func_array("explode",array(new Test(), &$my_var)); $my_var=array(1,2,3); -$data = call_user_func_array("implode",array(&$my_var, new StdClass())); +$data = call_user_func_array("implode",array(&$my_var, new Test())); echo "Done.\n"; ?> --EXPECT-- |