diff options
48 files changed, 283 insertions, 629 deletions
@@ -23,6 +23,7 @@ PHP 8.0 UPGRADE NOTES - Core: . Methods with the same name as the class are no longer interpreted as constructors. The __construct() method should be used instead. + . Removed ability to call non-static methods statically. . Removed (unset) cast. . Removed track_errors ini directive. This means that $php_errormsg is no longer available. The error_get_last() function may be used instead. diff --git a/Zend/tests/009.phpt b/Zend/tests/009.phpt index 82cfabee49..4a34fe4c84 100644 --- a/Zend/tests/009.phpt +++ b/Zend/tests/009.phpt @@ -16,9 +16,6 @@ class foo { class foo2 extends foo { } -foo::bar(); -foo2::bar(); - $f1 = new foo; $f2 = new foo2; @@ -36,11 +33,6 @@ $f1->testNull(); echo "Done\n"; ?> --EXPECTF-- -Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d -string(3) "foo" - -Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d -string(3) "foo" string(3) "foo" string(3) "foo" diff --git a/Zend/tests/bug27669.phpt b/Zend/tests/bug27669.phpt index 97b15590e2..747593031f 100644 --- a/Zend/tests/bug27669.phpt +++ b/Zend/tests/bug27669.phpt @@ -3,7 +3,7 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy --FILE-- <?php class A { - function hello() { + static function hello() { echo "Hello World\n"; } } @@ -12,6 +12,5 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy ?> ===DONE=== --EXPECTF-- -Deprecated: Non-static method A::hello() should not be called statically in %s on line %d Hello World ===DONE=== diff --git a/Zend/tests/bug35437.phpt b/Zend/tests/bug35437.phpt deleted file mode 100644 index 4f61e4fbfd..0000000000 --- a/Zend/tests/bug35437.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #35437 (Segfault or Invalid Opcode 137/1/4) ---FILE-- -<?php -function err2exception($errno, $errstr) -{ - throw new Exception("Error occuried: " . $errstr); -} - -set_error_handler('err2exception'); - -class TestClass -{ - function testMethod() - { - $GLOBALS['t'] = new stdClass; - } -} - -try { - TestClass::testMethod(); -} catch (Exception $e) { - echo "Caught: ".$e->getMessage()."\n"; -} -?> ---EXPECT-- -Caught: Error occuried: Non-static method TestClass::testMethod() should not be called statically diff --git a/Zend/tests/bug38047.phpt b/Zend/tests/bug38047.phpt deleted file mode 100644 index e6eeb6631d..0000000000 --- a/Zend/tests/bug38047.phpt +++ /dev/null @@ -1,51 +0,0 @@ ---TEST-- -Bug #38047 ("file" and "line" sometimes not set in backtrace from inside error handler) ---FILE-- -<?php -error_reporting(E_ALL); -set_error_handler('kalus_error_handler'); -ini_set("display_errors", "on"); - -class A { - function A_ftk($a) { - } -} - -function kalus_error_handler($error_code, $error_string, $filename, $line, $symbols) { - echo "$error_string\n"; - get_error_context(); -} - -function get_error_context() { - $backtrace = debug_backtrace(); - $n = 1; - foreach ($backtrace as $call) { - echo $n++." "; - if (isset($call["file"])) { - echo $call["file"]; - if (isset($call["line"])) { - echo ":".$call["line"]; - } - } - if (isset($call["function"])) { - echo " ".$call["function"]."()"; - } - echo "\n"; - } - echo "\n"; -} - -//This will not create file and line items for the call into the error handler -$page["name"] = A::A_ftk(); -?> ---EXPECTF-- -Non-static method A::A_ftk() should not be called statically -1 %sbug38047.php:13 get_error_context() -2 %sbug38047.php:36 kalus_error_handler() - - -Fatal error: Uncaught ArgumentCountError: Too few arguments to function A::A_ftk(), 0 passed in %sbug38047.php on line 36 and exactly 1 expected in %sbug38047.php:7 -Stack trace: -#0 %sbug38047.php(36): A::A_ftk() -#1 {main} - thrown in %sbug38047.php on line 7 diff --git a/Zend/tests/bug40621.phpt b/Zend/tests/bug40621.phpt index b56a28e58b..8650fd56fa 100644 --- a/Zend/tests/bug40621.phpt +++ b/Zend/tests/bug40621.phpt @@ -15,10 +15,7 @@ Foo::get(); echo "Done\n"; ?> --EXPECTF-- -Deprecated: Non-static method Foo::get() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Non-static method Foo::__construct() cannot be called statically in %s:%d +Fatal error: Uncaught Error: Non-static method Foo::get() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): Foo::get() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/bug47054.phpt b/Zend/tests/bug47054.phpt index 9e89c2c208..f607365bdc 100644 --- a/Zend/tests/bug47054.phpt +++ b/Zend/tests/bug47054.phpt @@ -24,8 +24,6 @@ $c->s(); get_called_class(); -D::m(); - ?> --EXPECTF-- Called class: D @@ -33,11 +31,3 @@ Called class: C Called class: C Warning: get_called_class() called from outside a class in %s on line %d - -Deprecated: Non-static method D::m() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d -Stack trace: -#0 %s(%d): D::m() -#1 {main} - thrown in %s on line %d diff --git a/Zend/tests/bug48533.phpt b/Zend/tests/bug48533.phpt index 4fa49a2f22..3dfbc658ec 100644 --- a/Zend/tests/bug48533.phpt +++ b/Zend/tests/bug48533.phpt @@ -26,8 +26,8 @@ $x->a(); $x->b(); $x->c(); $x::a(); -$x::b(); $x::c(); +$x::b(); ?> --EXPECTF-- @@ -35,7 +35,9 @@ string(9) "__call::a" int(2) string(9) "__call::c" string(15) "__callStatic::a" - -Deprecated: Non-static method foo::b() should not be called statically in %s on line %d -int(2) string(15) "__callStatic::c" + +Fatal error: Uncaught Error: Non-static method foo::b() cannot be called statically in %s:%d +Stack trace: +#0 {main} + thrown in %s on line %d diff --git a/Zend/tests/bug74408.phpt b/Zend/tests/bug74408.phpt deleted file mode 100644 index e770a51dc8..0000000000 --- a/Zend/tests/bug74408.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #74408 (Endless loop bypassing execution time limit) ---FILE-- -<?php - - class ErrorHandling { - - public function error_handler($errno, $errstr, $errfile, $errline) { - $bla = new NonExistingClass2(); - } - - public function exception_handler(Error $e) { - echo "Caught, exception: " . $e->getMessage(); - } - } - - set_error_handler('ErrorHandling::error_handler'); - set_exception_handler('ErrorHandling::exception_handler'); - - $blubb = new NonExistingClass(); -?> ---EXPECTF-- -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d - -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in %sbug74408.php on line %d - -Deprecated: Non-static method ErrorHandling::error_handler() should not be called statically in Unknown on line 0 - -Fatal error: Uncaught Error: Class 'NonExistingClass2' not found in %sbug74408.php:%d -Stack trace: -#0 [internal function]: ErrorHandling::error_handler(8192, 'Non-static meth...', '%s', %d, Array) -#1 %sbug74408.php(%d): set_exception_handler('ErrorHandling::...') -#2 {main} - thrown in %sbug74408.php on line %d diff --git a/Zend/tests/call_static_006.phpt b/Zend/tests/call_static_006.phpt index 2887afa355..946be2a3c9 100644 --- a/Zend/tests/call_static_006.phpt +++ b/Zend/tests/call_static_006.phpt @@ -4,29 +4,15 @@ Testing __callStatic <?php class foo { - public function aa() { - print "ok\n"; - } static function __callstatic($a, $b) { var_dump($a); } } -foo::aa(); - -$b = 'AA'; -foo::$b(); - foo::__construct(); ?> --EXPECTF-- -Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d -ok - -Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d -ok - Fatal error: Uncaught Error: Cannot call constructor in %s:%d Stack trace: #0 {main} diff --git a/Zend/tests/call_user_func_004.phpt b/Zend/tests/call_user_func_004.phpt deleted file mode 100644 index 7a2c4b8ffd..0000000000 --- a/Zend/tests/call_user_func_004.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Calling non-static method with call_user_func() ---FILE-- -<?php - -class foo { - public function teste() { - $this->a = 1; - } -} - -call_user_func(array('foo', 'teste')); - -?> ---EXPECTF-- -Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d -Stack trace: -#0 %s(%d): foo::teste() -#1 {main} - thrown in %s on line %d diff --git a/Zend/tests/call_user_func_005.phpt b/Zend/tests/call_user_func_005.phpt index 9305e5849c..13d69fd60d 100644 --- a/Zend/tests/call_user_func_005.phpt +++ b/Zend/tests/call_user_func_005.phpt @@ -9,7 +9,7 @@ class foo { return 1; } - public function teste() { + public static function teste() { return foo::x(function &($a=1,$b) { }); } } @@ -18,7 +18,6 @@ var_dump(call_user_func(array('foo', 'teste'))); ?> --EXPECTF-- -Deprecated: %son-static method foo::teste() should not be called statically in %s on line %d string(1) "x" array(1) { [0]=> diff --git a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt index 17d39c052e..24df1d186a 100644 --- a/Zend/tests/closures/closure_from_callable_non_static_statically.phpt +++ b/Zend/tests/closures/closure_from_callable_non_static_statically.phpt @@ -17,4 +17,4 @@ try { ?> --EXPECT-- -Failed to create closure from callable: non-static method A::method() should not be called statically +Failed to create closure from callable: non-static method A::method() cannot be called statically diff --git a/Zend/tests/exception_017.phpt b/Zend/tests/exception_017.phpt index f980b297fb..77fbf2d844 100644 --- a/Zend/tests/exception_017.phpt +++ b/Zend/tests/exception_017.phpt @@ -12,28 +12,29 @@ function foo(callable $x) { try { C::foo(); } catch (Error $e) { - echo "\nException: " . $e->getMessage() . " in " , $e->getFile() . " on line " . $e->getLine() . "\n"; + echo $e, "\n\n"; } try { foo("C::foo"); } catch (Error $e) { - echo "\n"; - do { - echo "Exception: " . $e->getMessage() . "\n"; - $e = $e->getPrevious(); - } while ($e instanceof Error); + echo $e, "\n\n"; } C::foo(); ?> --EXPECTF-- -Exception: Cannot call abstract method C::foo() in %sexception_017.php on line %d +Error: Cannot call abstract method C::foo() in %s:%d +Stack trace: +#0 {main} + +TypeError: Argument 1 passed to foo() must be callable, string given, called in %s on line %d and defined in %s:%d +Stack trace: +#0 %s(%d): foo('C::foo') +#1 {main} -Exception: Argument 1 passed to foo() must be callable, string given, called in %sexception_017.php on line %d -Exception: Cannot call abstract method C::foo() -Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %sexception_017.php:%d +Fatal error: Uncaught Error: Cannot call abstract method C::foo() in %s:%d Stack trace: #0 {main} - thrown in %sexception_017.php on line %d + thrown in %s on line %d diff --git a/Zend/tests/fr47160.phpt b/Zend/tests/fr47160.phpt index 786183c0c1..6567804902 100644 --- a/Zend/tests/fr47160.phpt +++ b/Zend/tests/fr47160.phpt @@ -36,20 +36,6 @@ class Magic3 { } } -$f = array('Hello','world'); -try { - var_dump($f('you')); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} -try { - var_dump(call_user_func($f, 'you')); -} catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; -} - -printf("-----\n"); - $h= new Hello; $f = array($h,'world'); var_dump($f('again')); @@ -107,14 +93,6 @@ var_dump(call_user_func($f, 'you')); ?> --EXPECTF-- -Deprecated: Non-static method Hello::world() should not be called statically in %s on line %d -Hello, you -Exception: Using $this when not in object context - -Deprecated: %son-static method Hello::world() should not be called statically in %s on line %d -Hello, you -Exception: Using $this when not in object context ------ Hello, again object(Hello)#%d (0) { } diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt index 25c95ba219..8c7461e4f7 100644 --- a/Zend/tests/incompat_ctx_user.phpt +++ b/Zend/tests/incompat_ctx_user.phpt @@ -4,18 +4,17 @@ Incompatible context call (non-internal function) <?php class A { - function foo() { var_dump(get_class($this)); } + function foo() { var_dump(get_class($this)); } } class B { - function bar() { A::foo(); } + function bar() { A::foo(); } } $b = new B; try { - $b->bar(); + $b->bar(); } catch (Throwable $e) { - echo "Exception: " . $e->getMessage() . "\n"; + echo "Exception: " . $e->getMessage() . "\n"; } ?> --EXPECTF-- -Deprecated: Non-static method A::foo() should not be called statically in %s on line %d -Exception: Using $this when not in object context +Exception: Non-static method A::foo() cannot be called statically diff --git a/Zend/tests/indirect_call_array_005.phpt b/Zend/tests/indirect_call_array_005.phpt index 4938856ed2..bd11df2d12 100644 --- a/Zend/tests/indirect_call_array_005.phpt +++ b/Zend/tests/indirect_call_array_005.phpt @@ -19,10 +19,7 @@ $callback = ['TestClass', 'method']; echo $callback(); ?> --EXPECTF-- -Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d +Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): TestClass::method() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/indirect_call_string_003.phpt b/Zend/tests/indirect_call_string_003.phpt index a6839df8a7..99289c4e1c 100644 --- a/Zend/tests/indirect_call_string_003.phpt +++ b/Zend/tests/indirect_call_string_003.phpt @@ -19,10 +19,7 @@ $callback = 'TestClass::method'; echo $callback(); ?> --EXPECTF-- -Deprecated: Non-static method TestClass::method() should not be called statically in %s on line %d - -Fatal error: Uncaught Error: Using $this when not in object context in %s:%d +Fatal error: Uncaught Error: Non-static method TestClass::method() cannot be called statically in %s:%d Stack trace: -#0 %s(%d): TestClass::method() -#1 {main} +#0 {main} thrown in %s on line %d diff --git a/Zend/tests/objects_027.phpt b/Zend/tests/objects_027.phpt index 6ee7d5a491..b579278f2e 100644 --- a/Zend/tests/objects_027.phpt +++ b/Zend/tests/objects_027.phpt @@ -17,26 +17,12 @@ class foo extends bar { $foo = new foo; $foo->test(); -$foo::test(); call_user_func(array($foo, 'test')); -call_user_func(array('foo', 'test')); ?> --EXPECTF-- object(foo)#%d (0) { } - -Deprecated: Non-static method foo::test() should not be called statically in %s on line %d - -Deprecated: Non-static method bar::show() should not be called statically in %s on line %d -object(foo)#%d (0) { -} -object(foo)#%d (0) { -} - -Deprecated: %son-static method foo::test() should not be called statically in %s on line %d - -Deprecated: Non-static method bar::show() should not be called statically in %s on line %d object(foo)#%d (0) { } diff --git a/Zend/tests/type_declarations/callable_001.phpt b/Zend/tests/type_declarations/callable_001.phpt index 3113bedcf0..d93e70923a 100644 --- a/Zend/tests/type_declarations/callable_001.phpt +++ b/Zend/tests/type_declarations/callable_001.phpt @@ -14,19 +14,13 @@ $closure = function () {}; foo("strpos"); foo("foo"); -foo(array("bar", "baz")); -foo(array("bar", "foo")); foo($closure); +foo(array("bar", "foo")); +foo(array("bar", "baz")); --EXPECTF-- string(6) "strpos" string(3) "foo" - -Deprecated: Non-static method bar::baz() should not be called statically in %s on line %d -array(2) { - [0]=> - string(3) "bar" - [1]=> - string(3) "baz" +object(Closure)#1 (0) { } array(2) { [0]=> @@ -34,5 +28,9 @@ array(2) { [1]=> string(3) "foo" } -object(Closure)#%d (0) { -} + +Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be callable, array given, called in %s on line %d and defined in %s:%d +Stack trace: +#0 %s(%d): foo(Array) +#1 {main} + thrown in %s on line %d diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 2ec6d34145..12309afd9e 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -768,23 +768,17 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } if (zend_fcall_info_init(arg, 0, fci, fcc, NULL, &is_callable_error) == SUCCESS) { - if (is_callable_error) { - *severity = E_DEPRECATED; - zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); - efree(is_callable_error); - *spec = spec_walk; - return ""; - } + ZEND_ASSERT(!is_callable_error); break; + } + + if (is_callable_error) { + *severity = E_ERROR; + zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); + efree(is_callable_error); + return ""; } else { - if (is_callable_error) { - *severity = E_ERROR; - zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); - efree(is_callable_error); - return ""; - } else { - return "valid callback"; - } + return "valid callback"; } } @@ -2338,25 +2332,21 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (ctor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Constructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(ctor->common.function_name)); } - ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (dtor) { if (dtor->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Destructor %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(dtor->common.function_name)); } - dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (clone) { if (clone->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "%s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(clone->common.function_name)); } - clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__call) { if (__call->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__call->common.function_name)); } - __call->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__callstatic) { if (!(__callstatic->common.fn_flags & ZEND_ACC_STATIC)) { @@ -2368,31 +2358,26 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio if (__tostring->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__tostring->common.function_name)); } - __tostring->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__get) { if (__get->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__get->common.function_name)); } - __get->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__set) { if (__set->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__set->common.function_name)); } - __set->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__unset) { if (__unset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__unset->common.function_name)); } - __unset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__isset) { if (__isset->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Method %s::%s() cannot be static", ZSTR_VAL(scope->name), ZSTR_VAL(__isset->common.function_name)); } - __isset->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (__debugInfo) { if (__debugInfo->common.fn_flags & ZEND_ACC_STATIC) { @@ -3079,38 +3064,14 @@ get_function_via_handler: if (retval) { if (fcc->calling_scope && !call_via_handler) { if (fcc->function_handler->common.fn_flags & ZEND_ACC_ABSTRACT) { + retval = 0; if (error) { zend_spprintf(error, 0, "cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); - retval = 0; - } else { - zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); - retval = 0; } } else if (!fcc->object && !(fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) { - int severity; - char *verb; - if (fcc->function_handler->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - severity = E_DEPRECATED; - verb = "should not"; - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - severity = E_ERROR; - verb = "cannot"; - } - if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) { - retval = 0; - } + retval = 0; if (error) { - zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - if (severity != E_DEPRECATED) { - retval = 0; - } - } else if (retval) { - if (severity == E_ERROR) { - zend_throw_error(NULL, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - } else { - zend_error(severity, "Non-static method %s::%s() %s be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name), verb); - } + zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically", ZSTR_VAL(fcc->calling_scope->name), ZSTR_VAL(fcc->function_handler->common.function_name)); } } if (retval @@ -3366,7 +3327,7 @@ ZEND_API zend_bool zend_make_callable(zval *callable, zend_string **callable_nam { zend_fcall_info_cache fcc; - if (zend_is_callable_ex(callable, NULL, IS_CALLABLE_STRICT, callable_name, &fcc, NULL)) { + if (zend_is_callable_ex(callable, NULL, 0, callable_name, &fcc, NULL)) { if (Z_TYPE_P(callable) == IS_STRING && fcc.calling_scope) { zval_ptr_dtor_str(callable); array_init(callable); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 6bc7ed4ffb..70eda777b0 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -297,11 +297,8 @@ ZEND_API ZEND_COLD void zend_wrong_param_count(void); #define IS_CALLABLE_CHECK_SYNTAX_ONLY (1<<0) #define IS_CALLABLE_CHECK_NO_ACCESS (1<<1) -#define IS_CALLABLE_CHECK_IS_STATIC (1<<2) #define IS_CALLABLE_CHECK_SILENT (1<<3) -#define IS_CALLABLE_STRICT (IS_CALLABLE_CHECK_IS_STATIC) - ZEND_API zend_string *zend_get_callable_name_ex(zval *callable, zend_object *object); ZEND_API zend_string *zend_get_callable_name(zval *callable); ZEND_API zend_bool zend_is_callable_ex(zval *callable, zend_object *object, uint32_t check_flags, zend_string **callable_name, zend_fcall_info_cache *fcc, char **error); @@ -471,7 +468,6 @@ ZEND_API extern const zend_fcall_info_cache empty_fcall_info_cache; * fci->param_count = 0; * fci->params = NULL; * The callable_name argument may be NULL. - * Set check_flags to IS_CALLABLE_STRICT for every new usage! */ ZEND_API int zend_fcall_info_init(zval *callable, uint32_t check_flags, zend_fcall_info *fci, zend_fcall_info_cache *fcc, zend_string **callable_name, char **error); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index ac95108cae..3e688eabea 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -319,7 +319,7 @@ ZEND_METHOD(Closure, fromCallable) success = zend_create_closure_from_callable(return_value, callable, &error); EG(current_execute_data) = execute_data; - if (success == FAILURE || error) { + if (success == FAILURE) { if (error) { zend_type_error("Failed to create closure from callable: %s", error); efree(error); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0d7f8b1b25..fc42bf5e63 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5629,12 +5629,8 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo "public visibility and cannot be static"); } } - } else { - if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') { - if (!is_static) { - op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC; - } - } else if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) { + } else if (ZSTR_VAL(lcname)[0] == '_' && ZSTR_VAL(lcname)[1] == '_') { + if (zend_string_equals_literal(lcname, ZEND_CONSTRUCTOR_FUNC_NAME)) { ce->constructor = (zend_function *) op_array; } else if (zend_string_equals_literal(lcname, ZEND_DESTRUCTOR_FUNC_NAME)) { ce->destructor = (zend_function *) op_array; @@ -5697,8 +5693,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo "public visibility and cannot be static"); } ce->__debugInfo = (zend_function *) op_array; - } else if (!is_static) { - op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC; } } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index f46603322e..c6a94ba48b 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -282,10 +282,6 @@ typedef struct _zend_oparray_context { /* ZEND_DECLARE_INHERITED_CLASS_DELAYED opcodes | | | */ #define ZEND_ACC_EARLY_BINDING (1 << 15) /* | X | | */ /* | | | */ -/* method flag (bc only), any method that has this | | | */ -/* flag can be used statically and non statically. | | | */ -#define ZEND_ACC_ALLOW_STATIC (1 << 16) /* | X | | */ -/* | | | */ /* call through user function trampoline. e.g. | | | */ /* __call, __callstatic | | | */ #define ZEND_ACC_CALL_VIA_TRAMPOLINE (1 << 17) /* | X | | */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index d27c2d5619..6d037afd3c 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1969,16 +1969,10 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call(z static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call(const zend_function *fbc) { - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, - "Non-static method %s::%s() should not be called statically", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); - } else { - zend_throw_error( - zend_ce_error, - "Non-static method %s::%s() cannot be called statically", - ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); - } + zend_throw_error( + zend_ce_error, + "Non-static method %s::%s() cannot be called statically", + ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name)); } static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref(const zend_function *func, uint32_t arg_num) @@ -3829,9 +3823,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - return NULL; - } + return NULL; } if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) { init_func_run_time_cache(&fbc->op_array); @@ -3947,9 +3939,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar } if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - return NULL; - } + return NULL; } } else { called_scope = Z_OBJCE_P(obj); diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index edab6edaa7..244ecc3f01 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -703,20 +703,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) / EG(current_execute_data) = dummy_execute_data.prev_execute_data; } return FAILURE; - } else if (error) { - /* Capitalize the first latter of the error message */ - if (error[0] >= 'a' && error[0] <= 'z') { - error[0] += ('A' - 'a'); - } - zend_error(E_DEPRECATED, "%s", error); - efree(error); - if (UNEXPECTED(EG(exception))) { - if (EG(current_execute_data) == &dummy_execute_data) { - EG(current_execute_data) = dummy_execute_data.prev_execute_data; - } - return FAILURE; - } } + + ZEND_ASSERT(!error); } func = fci_cache->function_handler; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index e03133d2da..60fad3f4a6 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -3529,9 +3529,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, UNUSED|CLASS_FETCH|CONST|VAR, ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -3656,18 +3654,10 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM) SAVE_OPLINE(); function_name = GET_OP2_ZVAL_PTR(BP_VAR_R); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - FREE_OP2(); - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index e00beafc25..3bba9808ac 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -5514,9 +5514,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -5556,18 +5554,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONS SAVE_OPLINE(); function_name = RT_CONSTANT(opline, opline->op2); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -7797,9 +7787,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -7839,18 +7827,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMPV SAVE_OPLINE(); function_name = _get_zval_ptr_var(opline->op2.var, &free_op2 EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - zval_ptr_dtor_nogc(free_op2); - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -9483,9 +9463,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -11270,9 +11248,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_C ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -11312,18 +11288,10 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_H SAVE_OPLINE(); function_name = _get_zval_ptr_cv_BP_VAR_R(opline->op2.var EXECUTE_DATA_CC); if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) { + ZEND_ASSERT(!error); func = fcc.function_handler; called_scope = fcc.called_scope; object = fcc.object; - if (error) { - efree(error); - /* This is the only soft error is_callable() can generate */ - zend_non_static_method_call(func); - if (UNEXPECTED(EG(exception) != NULL)) { - - HANDLE_EXCEPTION(); - } - } if (func->common.fn_flags & ZEND_ACC_CLOSURE) { /* Delay closure destruction until its invocation */ GC_ADDREF(ZEND_CLOSURE_OBJECT(func)); @@ -25895,9 +25863,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -28646,9 +28612,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -30386,9 +30350,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -33118,9 +33080,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_V ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -35413,9 +35373,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -37353,9 +37311,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -37885,9 +37841,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } @@ -39938,9 +39892,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_U ce = object->ce; } else { zend_non_static_method_call(fbc); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } + HANDLE_EXCEPTION(); } } diff --git a/ext/com_dotnet/com_persist.c b/ext/com_dotnet/com_persist.c index c782e6695c..116ec282d2 100644 --- a/ext/com_dotnet/com_persist.c +++ b/ext/com_dotnet/com_persist.c @@ -287,7 +287,6 @@ PHP_COM_DOTNET_API IStream *php_com_wrapper_export_stream(php_stream *stream) } #define CPH_ME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_PUBLIC) -#define CPH_SME(fname, arginfo) PHP_ME(com_persist, fname, arginfo, ZEND_ACC_ALLOW_STATIC|ZEND_ACC_PUBLIC) #define CPH_METHOD(fname) static PHP_METHOD(com_persist, fname) #define CPH_FETCH() php_com_persist_helper *helper = (php_com_persist_helper*)Z_OBJ_P(getThis()); diff --git a/ext/dom/document.c b/ext/dom/document.c index edb4e33af2..ea7825752d 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -210,16 +210,16 @@ const zend_function_entry php_dom_document_class_functions[] = { /* {{{ */ PHP_FALIAS(adoptNode, dom_document_adopt_node, arginfo_dom_document_adopt_node) PHP_FALIAS(normalizeDocument, dom_document_normalize_document, arginfo_dom_document_normalize_document) PHP_FALIAS(renameNode, dom_document_rename_node, arginfo_dom_document_rename_node) - PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, load, arginfo_dom_document_load, ZEND_ACC_PUBLIC) PHP_FALIAS(save, dom_document_save, arginfo_dom_document_save) - PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, loadXML, arginfo_dom_document_loadxml, ZEND_ACC_PUBLIC) PHP_FALIAS(saveXML, dom_document_savexml, arginfo_dom_document_savexml) PHP_ME(domdocument, __construct, arginfo_dom_document_construct, ZEND_ACC_PUBLIC) PHP_FALIAS(validate, dom_document_validate, arginfo_dom_document_validate) PHP_FALIAS(xinclude, dom_document_xinclude, arginfo_dom_document_xinclude) #if defined(LIBXML_HTML_ENABLED) - PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domdocument, loadHTML, arginfo_dom_document_loadhtml, ZEND_ACC_PUBLIC) + PHP_ME(domdocument, loadHTMLFile, arginfo_dom_document_loadhtmlfile, ZEND_ACC_PUBLIC) PHP_FALIAS(saveHTML, dom_document_save_html, arginfo_dom_document_savehtml) PHP_FALIAS(saveHTMLFile, dom_document_save_html_file, arginfo_dom_document_savehtmlfile) #endif /* defined(LIBXML_HTML_ENABLED) */ diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c index c6629c85e9..e6565b348d 100644 --- a/ext/dom/domimplementation.c +++ b/ext/dom/domimplementation.c @@ -55,10 +55,10 @@ ZEND_END_ARG_INFO(); */ const zend_function_entry php_dom_domimplementation_class_functions[] = { - PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) - PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(domimplementation, getFeature, arginfo_dom_implementation_get_feature, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, hasFeature, arginfo_dom_implementation_has_feature, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, createDocumentType, arginfo_dom_implementation_create_documenttype, ZEND_ACC_PUBLIC) + PHP_ME(domimplementation, createDocument, arginfo_dom_implementation_create_document, ZEND_ACC_PUBLIC) PHP_FE_END }; diff --git a/ext/opcache/tests/wrong_inlining_002.phpt b/ext/opcache/tests/wrong_inlining_002.phpt index 4e71a96d10..9aaa60c534 100644 --- a/ext/opcache/tests/wrong_inlining_002.phpt +++ b/ext/opcache/tests/wrong_inlining_002.phpt @@ -20,10 +20,7 @@ class Foo { Foo::test(); ?> --EXPECTF-- -Deprecated: Non-static method Foo::test() should not be called statically in %swrong_inlining_002.php on line 11 - -Fatal error: Uncaught Error: Using $this when not in object context in %swrong_inlining_002.php:7 +Fatal error: Uncaught Error: Non-static method Foo::test() cannot be called statically in %s:%d Stack trace: -#0 %swrong_inlining_002.php(11): Foo::test() -#1 {main} - thrown in %swrong_inlining_002.php on line 7 +#0 {main} + thrown in %s on line %d diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index c452d4c34f..c788b4ee90 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -117,14 +117,11 @@ array(2) { string(4) "2---" } -Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: cannot access private method bar::test2() in %s on line %d +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test2() cannot be called statically in %s on line %d +bool(false) + +Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: non-static method bar::test3() cannot be called statically in %s on line %d bool(false) -array(2) { - [0]=> - string(7) "1===php" - [1]=> - string(4) "2===" -} Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: class 'bar' does not have a method 'inexistent' in %s on line %d bool(false) diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index e735cc0134..615d342729 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -513,7 +513,7 @@ PHP_FUNCTION(spl_autoload_register) } if (ZEND_NUM_ARGS()) { - if (!zend_is_callable_ex(zcallable, NULL, IS_CALLABLE_STRICT, &func_name, &fcc, &error)) { + if (!zend_is_callable_ex(zcallable, NULL, 0, &func_name, &fcc, &error)) { alfi.ce = fcc.calling_scope; alfi.func_ptr = fcc.function_handler; obj_ptr = fcc.object; diff --git a/ext/spl/tests/spl_autoload_005.phpt b/ext/spl/tests/spl_autoload_005.phpt index ccebf91f04..58198c2ff1 100644 --- a/ext/spl/tests/spl_autoload_005.phpt +++ b/ext/spl/tests/spl_autoload_005.phpt @@ -48,7 +48,7 @@ catch(Exception $e) ===DONE=== <?php exit(0); ?> --EXPECT-- -Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() should not be called statically) +Exception: Passed array specifies a non static method but no object (non-static method MyAutoLoader::autoLoad() cannot be called statically) MyAutoLoader::autoLoad(TestClass) MyAutoLoader::autoThrow(TestClass) Exception: Unavailable diff --git a/ext/spl/tests/spl_autoload_007.phpt b/ext/spl/tests/spl_autoload_007.phpt index 1a81f191c7..1cddac4234 100644 --- a/ext/spl/tests/spl_autoload_007.phpt +++ b/ext/spl/tests/spl_autoload_007.phpt @@ -66,7 +66,7 @@ string(22) "MyAutoLoader::autoLoad" ok string(22) "MyAutoLoader::dynaLoad" -Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically) +Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically) array(2) { [0]=> @@ -98,7 +98,7 @@ array(2) { [1]=> string(8) "dynaLoad" } -Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically) +Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically) array(2) { [0]=> diff --git a/ext/spl/tests/spl_autoload_008.phpt b/ext/spl/tests/spl_autoload_008.phpt index df795d02b6..51fbdd2e9f 100644 --- a/ext/spl/tests/spl_autoload_008.phpt +++ b/ext/spl/tests/spl_autoload_008.phpt @@ -80,7 +80,7 @@ Exception: Bla int(0) ====2==== string(22) "MyAutoLoader::dynaLoad" -LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() should not be called statically) +LogicException: Function 'MyAutoLoader::dynaLoad' not callable (non-static method MyAutoLoader::dynaLoad() cannot be called statically) int(0) ====3==== array(2) { @@ -100,7 +100,7 @@ array(2) { [1]=> string(8) "dynaLoad" } -LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() should not be called statically) +LogicException: Passed array specifies a non static method but no object (non-static method MyAutoLoader::dynaLoad() cannot be called statically) int(0) ====5==== array(2) { diff --git a/ext/standard/tests/array/array_map_object1.phpt b/ext/standard/tests/array/array_map_object1.phpt index b808381048..944fc8c2c8 100644 --- a/ext/standard/tests/array/array_map_object1.phpt +++ b/ext/standard/tests/array/array_map_object1.phpt @@ -22,7 +22,7 @@ echo "-- simple class with public variable and method --\n"; class SimpleClass { public $var1 = 1; - public function square($n) { + public static function square($n) { return $n * $n; } } @@ -36,7 +36,7 @@ echo "\n-- simple class with private variable and method --\n"; class SimpleClassPri { private $var1 = 10; - private function add($n) { + private static function add($n) { return $var + $n; } } @@ -46,7 +46,7 @@ echo "\n-- simple class with protected variable and method --\n"; class SimpleClassPro { protected $var1 = 5; - protected function mul($n) { + protected static function mul($n) { return $var1 * $n; } } @@ -62,14 +62,14 @@ echo "\n-- abstract class --\n"; abstract class AbstractClass { protected $var2 = 5; - abstract function emptyFunction(); + abstract static function emptyFunction(); } // class deriving the above abstract class class ChildClass extends AbstractClass { private $var3; - public function emptyFunction() { + public static function emptyFunction() { echo "defined in child\n"; } } @@ -79,7 +79,7 @@ echo "\n-- class with final method --\n"; class FinalClass { private $var4; - final function finalMethod() { + final static function finalMethod() { echo "This function can't be overloaded\n"; } } @@ -126,8 +126,6 @@ test(array('InterClass', 'square'), array(1, 2)); *** Testing array_map() : object functionality *** -- simple class with public variable and method -- SimpleClass::square - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method SimpleClass::square() should not be called statically in %sarray_map_object1.php on line %d array(2) { [0]=> int(1) @@ -155,8 +153,6 @@ NULL -- abstract class -- ChildClass::emptyFunction - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method ChildClass::emptyFunction() should not be called statically in %sarray_map_object1.php on line %d defined in child defined in child array(2) { @@ -168,8 +164,6 @@ array(2) { -- class with final method -- FinalClass::finalMethod - -Deprecated: array_map() expects parameter 1 to be a valid callback, non-static method FinalClass::finalMethod() should not be called statically in %sarray_map_object1.php on line %d This function can't be overloaded This function can't be overloaded array(2) { diff --git a/ext/standard/tests/general_functions/010.phpt b/ext/standard/tests/general_functions/010.phpt index 51132c6a15..99971616d2 100644 --- a/ext/standard/tests/general_functions/010.phpt +++ b/ext/standard/tests/general_functions/010.phpt @@ -3,24 +3,19 @@ register_shutdown_function() & __call --FILE-- <?php class test { - function _foo() { - throw new Exception('test'); - } - function __call($name=null, $args=null) { - return test::_foo(); - } + function _foo() { + throw new Exception('test'); + } + function __call($name=null, $args=null) { + return test::_foo(); + } } -try { - var_dump(register_shutdown_function(array("test","__call"))); -} catch (Error $e) { - echo "\nException: " . $e->getMessage() . "\n"; -} +var_dump(register_shutdown_function(array("test","__call"))); echo "Done\n"; ?> --EXPECTF-- -Exception: Non-static method test::__call() cannot be called statically +Warning: register_shutdown_function(): Invalid shutdown callback 'test::__call' passed in %s on line %d +bool(false) Done - -Fatal error: Non-static method test::__call() cannot be called statically in %s on line %d diff --git a/ext/standard/tests/general_functions/bug32647.phpt b/ext/standard/tests/general_functions/bug32647.phpt index c6ff94833d..a9d84e798b 100644 --- a/ext/standard/tests/general_functions/bug32647.phpt +++ b/ext/standard/tests/general_functions/bug32647.phpt @@ -46,13 +46,8 @@ Warning: register_shutdown_function(): Invalid shutdown callback 'Array' passed Warning: register_shutdown_function(): Invalid shutdown callback 'bar' passed in %s on line %d -Deprecated: Non-static method bar::barfoo() should not be called statically in %sbug32647.php on line %d +Warning: register_shutdown_function(): Invalid shutdown callback 'bar::barfoo' passed in %sbug32647.php on line %d Warning: register_shutdown_function(): Invalid shutdown callback 'bar::foobar' passed in %sbug32647.php on line %d foo! - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 - -Deprecated: Non-static method bar::barfoo() should not be called statically in Unknown on line 0 -bar! bar! diff --git a/ext/standard/tests/general_functions/bug47857.phpt b/ext/standard/tests/general_functions/bug47857.phpt index d19eca7248..c06673bc34 100644 --- a/ext/standard/tests/general_functions/bug47857.phpt +++ b/ext/standard/tests/general_functions/bug47857.phpt @@ -8,18 +8,20 @@ class foo { } } var_dump(is_callable(array('foo','bar'))); -foo::bar(); +try { + foo::bar(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} var_dump(is_callable(array('Exception','getMessage'))); -Exception::getMessage(); +try { + Exception::getMessage(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -bool(true) - -Deprecated: Non-static method foo::bar() should not be called statically in %sbug47857.php on line %d -ok +--EXPECT-- +bool(false) +Non-static method foo::bar() cannot be called statically bool(false) - -Fatal error: Uncaught Error: Non-static method Exception::getMessage() cannot be called statically in %sbug47857.php:%d -Stack trace: -#0 {main} - thrown in %sbug47857.php on line %d +Non-static method Exception::getMessage() cannot be called statically diff --git a/ext/standard/tests/general_functions/is_callable_basic2.phpt b/ext/standard/tests/general_functions/is_callable_basic2.phpt index 7657875311..7b43191aab 100644 --- a/ext/standard/tests/general_functions/is_callable_basic2.phpt +++ b/ext/standard/tests/general_functions/is_callable_basic2.phpt @@ -207,12 +207,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 1 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 2 --- -- Innerloop iteration 1 of Outerloop iteration 2 -- @@ -288,12 +288,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 2 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 3 --- -- Innerloop iteration 1 of Outerloop iteration 3 -- @@ -369,12 +369,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 3 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 4 --- -- Innerloop iteration 1 of Outerloop iteration 4 -- @@ -450,12 +450,12 @@ contains_object_class::func bool(true) contains_object_class::func -- Innerloop iteration 10 of Outerloop iteration 4 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 5 --- -- Innerloop iteration 1 of Outerloop iteration 5 -- @@ -531,12 +531,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 5 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 6 --- -- Innerloop iteration 1 of Outerloop iteration 6 -- @@ -612,12 +612,12 @@ no_member_class::func bool(false) no_member_class::func -- Innerloop iteration 10 of Outerloop iteration 6 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 7 --- -- Innerloop iteration 1 of Outerloop iteration 7 -- @@ -693,12 +693,12 @@ object_class::func bool(false) object_class::func -- Innerloop iteration 10 of Outerloop iteration 7 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 --- Outerloop iteration 8 --- -- Innerloop iteration 1 of Outerloop iteration 8 -- @@ -774,11 +774,11 @@ Array bool(false) Array -- Innerloop iteration 10 of Outerloop iteration 8 -- +bool(false) bool(true) -bool(true) -bool(true) +bool(false) bool(true) object_class::foo1 -bool(true) +bool(false) object_class::foo1 ===DONE=== diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c index 2710be98c6..3ba98e77c3 100644 --- a/ext/xmlreader/php_xmlreader.c +++ b/ext/xmlreader/php_xmlreader.c @@ -1259,7 +1259,7 @@ static const zend_function_entry xmlreader_functions[] /* {{{ */ = { PHP_ME(xmlreader, moveToElement, arginfo_xmlreader_moveToElement, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, moveToFirstAttribute, arginfo_xmlreader_moveToFirstAttribute, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, moveToNextAttribute, arginfo_xmlreader_moveToNextAttribute, ZEND_ACC_PUBLIC) - PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(xmlreader, open, arginfo_xmlreader_open, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, read, arginfo_xmlreader_read, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, next, arginfo_xmlreader_next, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, readInnerXml, arginfo_xmlreader_readInnerXml, ZEND_ACC_PUBLIC) @@ -1272,7 +1272,7 @@ static const zend_function_entry xmlreader_functions[] /* {{{ */ = { PHP_ME(xmlreader, setParserProperty, arginfo_xmlreader_setParserProperty, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, setRelaxNGSchema, arginfo_xmlreader_setRelaxNGSchema, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, setRelaxNGSchemaSource, arginfo_xmlreader_setRelaxNGSchemaSource, ZEND_ACC_PUBLIC) - PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC|ZEND_ACC_ALLOW_STATIC) + PHP_ME(xmlreader, XML, arginfo_xmlreader_XML, ZEND_ACC_PUBLIC) PHP_ME(xmlreader, expand, arginfo_xmlreader_expand, ZEND_ACC_PUBLIC) PHP_FE_END }; /* }}} */ diff --git a/tests/lang/bug23384.phpt b/tests/lang/bug23384.phpt index 2dc3f2308b..220cf9f654 100644 --- a/tests/lang/bug23384.phpt +++ b/tests/lang/bug23384.phpt @@ -5,7 +5,7 @@ Bug #23384 (use of class constants in statics) define('TEN', 10); class Foo { const HUN = 100; - function test($x = Foo::HUN) { + static function test($x = Foo::HUN) { static $arr2 = array(TEN => 'ten'); static $arr = array(Foo::HUN => 'ten'); @@ -18,8 +18,7 @@ class Foo { Foo::test(); echo Foo::HUN."\n"; ?> ---EXPECTF-- -Deprecated: Non-static method Foo::test() should not be called statically in %sbug23384.php on line %d +--EXPECT-- Array ( [100] => ten diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt index dc32962d67..ffa5de589f 100644 --- a/tests/lang/passByReference_005.phpt +++ b/tests/lang/passByReference_005.phpt @@ -4,70 +4,95 @@ Pass uninitialised variables by reference and by value to test implicit initiali <?php function v($val) { - $val = "Val changed"; + $val = "Val changed"; } function r(&$ref) { - $ref = "Ref changed"; + $ref = "Ref changed"; } - function vv($val1, $val2) { - $val1 = "Val1 changed"; - $val2 = "Val2 changed"; + $val1 = "Val1 changed"; + $val2 = "Val2 changed"; } function vr($val, &$ref) { - $val = "Val changed"; - $ref = "Ref changed"; + $val = "Val changed"; + $ref = "Ref changed"; } function rv(&$ref, $val) { - $val = "Val changed"; - $ref = "Ref changed"; + $val = "Val changed"; + $ref = "Ref changed"; } function rr(&$ref1, &$ref2) { - $ref1 = "Ref1 changed"; - $ref2 = "Ref2 changed"; + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; } class C { - - function __construct($val, &$ref) { - $val = "Val changed"; - $ref = "Ref changed"; - } - - function v($val) { - $val = "Val changed"; - } - - function r(&$ref) { - $ref = "Ref changed"; - } - - function vv($val1, $val2) { - $val1 = "Val1 changed"; - $val2 = "Val2 changed"; - } - - function vr($val, &$ref) { - $val = "Val changed"; - $ref = "Ref changed"; - } - - function rv(&$ref, $val) { - $val = "Val changed"; - $ref = "Ref changed"; - } - - function rr(&$ref1, &$ref2) { - $ref1 = "Ref1 changed"; - $ref2 = "Ref2 changed"; - } - + function __construct($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function v($val) { + $val = "Val changed"; + } + + function r(&$ref) { + $ref = "Ref changed"; + } + + function vv($val1, $val2) { + $val1 = "Val1 changed"; + $val2 = "Val2 changed"; + } + + function vr($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function rv(&$ref, $val) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + function rr(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } + + static function static_v($val) { + $val = "Val changed"; + } + + static function static_r(&$ref) { + $ref = "Ref changed"; + } + + static function static_vv($val1, $val2) { + $val1 = "Val1 changed"; + $val2 = "Val2 changed"; + } + + static function static_vr($val, &$ref) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + static function static_rv(&$ref, $val) { + $val = "Val changed"; + $ref = "Ref changed"; + } + + static function static_rr(&$ref1, &$ref2) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + } } echo "\n ---- Pass by ref / pass by val: functions ----\n"; @@ -95,24 +120,24 @@ var_dump($u1, $u2); echo "\n\n ---- Pass by ref / pass by val: static method calls ----\n"; unset($u1, $u2); -C::v($u1); -C::r($u2); +C::static_v($u1); +C::static_r($u2); var_dump($u1, $u2); unset($u1, $u2); -C::vv($u1, $u2); +C::static_vv($u1, $u2); var_dump($u1, $u2); unset($u1, $u2); -C::vr($u1, $u2); +C::static_vr($u1, $u2); var_dump($u1, $u2); unset($u1, $u2); -C::rv($u1, $u2); +C::static_rv($u1, $u2); var_dump($u1, $u2); unset($u1, $u2); -C::rr($u1, $u2); +C::static_rr($u1, $u2); var_dump($u1, $u2); echo "\n\n ---- Pass by ref / pass by val: instance method calls ----\n"; @@ -145,31 +170,31 @@ var_dump($u1, $u2); --EXPECTF-- ---- Pass by ref / pass by val: functions ---- -Notice: Undefined variable: u1 in %s on line 72 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 74 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Notice: Undefined variable: u1 in %s on line 77 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 77 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u1 in %s on line 78 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 78 +Notice: Undefined variable: u2 in %s on line %d NULL NULL -Notice: Undefined variable: u1 in %s on line 81 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 82 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Notice: Undefined variable: u2 in %s on line 85 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u2 in %s on line 86 +Notice: Undefined variable: u2 in %s on line %d string(11) "Ref changed" NULL string(12) "Ref1 changed" @@ -178,82 +203,70 @@ string(12) "Ref2 changed" ---- Pass by ref / pass by val: static method calls ---- -Deprecated: Non-static method C::v() should not be called statically in %s on line 95 - -Notice: Undefined variable: u1 in %s on line 95 +Notice: Undefined variable: u1 in %s on line %d -Deprecated: Non-static method C::r() should not be called statically in %s on line 96 - -Notice: Undefined variable: u1 in %s on line 97 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Deprecated: Non-static method C::vv() should not be called statically in %s on line 100 - -Notice: Undefined variable: u1 in %s on line 100 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 100 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u1 in %s on line 101 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 101 +Notice: Undefined variable: u2 in %s on line %d NULL NULL -Deprecated: Non-static method C::vr() should not be called statically in %s on line 104 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 104 - -Notice: Undefined variable: u1 in %s on line 105 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Deprecated: Non-static method C::rv() should not be called statically in %s on line 108 - -Notice: Undefined variable: u2 in %s on line 108 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u2 in %s on line 109 +Notice: Undefined variable: u2 in %s on line %d string(11) "Ref changed" NULL - -Deprecated: Non-static method C::rr() should not be called statically in %s on line 112 string(12) "Ref1 changed" string(12) "Ref2 changed" ---- Pass by ref / pass by val: instance method calls ---- -Notice: Undefined variable: u1 in %s on line 117 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 118 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Notice: Undefined variable: u1 in %s on line 121 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 123 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Notice: Undefined variable: u1 in %s on line 126 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 126 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u1 in %s on line 127 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u2 in %s on line 127 +Notice: Undefined variable: u2 in %s on line %d NULL NULL -Notice: Undefined variable: u1 in %s on line 130 +Notice: Undefined variable: u1 in %s on line %d -Notice: Undefined variable: u1 in %s on line 131 +Notice: Undefined variable: u1 in %s on line %d NULL string(11) "Ref changed" -Notice: Undefined variable: u2 in %s on line 134 +Notice: Undefined variable: u2 in %s on line %d -Notice: Undefined variable: u2 in %s on line 135 +Notice: Undefined variable: u2 in %s on line %d string(11) "Ref changed" NULL string(12) "Ref1 changed" diff --git a/tests/lang/passByReference_006.phpt b/tests/lang/passByReference_006.phpt index 9f5d275333..0fc2e390ae 100644 --- a/tests/lang/passByReference_006.phpt +++ b/tests/lang/passByReference_006.phpt @@ -30,6 +30,14 @@ class C { $ref5 = "Ref5 changed"; } + static function static_refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) { + $ref1 = "Ref1 changed"; + $ref2 = "Ref2 changed"; + $ref3 = "Ref3 changed"; + $ref4 = "Ref4 changed"; + $ref5 = "Ref5 changed"; + } + } echo "\n ---- Pass uninitialised array & object by ref: function call ---\n"; @@ -39,7 +47,7 @@ var_dump($u1, $u2, $u3, $u4, $u5); echo "\n ---- Pass uninitialised arrays & objects by ref: static method call ---\n"; unset($u1, $u2, $u3, $u4, $u5); -C::refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c); +C::static_refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c); var_dump($u1, $u2, $u3, $u4, $u5); echo "\n\n---- Pass uninitialised arrays & objects by ref: constructor ---\n"; @@ -89,8 +97,6 @@ object(stdClass)#%d (1) { } ---- Pass uninitialised arrays & objects by ref: static method call --- - -Deprecated: Non-static method C::refs() should not be called statically in %s on line 39 array(1) { [0]=> string(12) "Ref1 changed" diff --git a/tests/output/ob_start_basic_005.phpt b/tests/output/ob_start_basic_005.phpt index 7cab6ed35f..dda6587614 100644 --- a/tests/output/ob_start_basic_005.phpt +++ b/tests/output/ob_start_basic_005.phpt @@ -25,9 +25,10 @@ checkAndClean(); ?> --EXPECTF-- -Warning: ob_start(): non-static method C::h() should not be called statically in %s on line 20 -bool(true) +Warning: ob_start(): non-static method C::h() cannot be called statically in %s on line %d + +Notice: ob_start(): failed to create buffer in %s on line %d +bool(false) Array ( - [0] => C::h ) |