Skip to content

Commit 6c73b50

Browse files
committed
Remove static calls to non-static methods
1 parent 4eb5db2 commit 6c73b50

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+283
-629
lines changed

UPGRADING

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ PHP 8.0 UPGRADE NOTES
2323
- Core:
2424
. Methods with the same name as the class are no longer interpreted as
2525
constructors. The __construct() method should be used instead.
26+
. Removed ability to call non-static methods statically.
2627
. Removed (unset) cast.
2728
. Removed track_errors ini directive. This means that $php_errormsg is no
2829
longer available. The error_get_last() function may be used instead.

Zend/tests/009.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ class foo {
1616
class foo2 extends foo {
1717
}
1818

19-
foo::bar();
20-
foo2::bar();
21-
2219
$f1 = new foo;
2320
$f2 = new foo2;
2421

@@ -36,11 +33,6 @@ $f1->testNull();
3633
echo "Done\n";
3734
?>
3835
--EXPECTF--
39-
Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
40-
string(3) "foo"
41-
42-
Deprecated: Non-static method foo::bar() should not be called statically in %s on line %d
43-
string(3) "foo"
4436
string(3) "foo"
4537
string(3) "foo"
4638

Zend/tests/bug27669.phpt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
33
--FILE--
44
<?php
55
class A {
6-
function hello() {
6+
static function hello() {
77
echo "Hello World\n";
88
}
99
}
@@ -12,6 +12,5 @@ Bug #27669 (PHP 5 didn't support all possibilities for calling static methods dy
1212
?>
1313
===DONE===
1414
--EXPECTF--
15-
Deprecated: Non-static method A::hello() should not be called statically in %s on line %d
1615
Hello World
1716
===DONE===

Zend/tests/bug35437.phpt

Lines changed: 0 additions & 27 deletions
This file was deleted.

Zend/tests/bug38047.phpt

Lines changed: 0 additions & 51 deletions
This file was deleted.

Zend/tests/bug40621.phpt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ Foo::get();
1515
echo "Done\n";
1616
?>
1717
--EXPECTF--
18-
Deprecated: Non-static method Foo::get() should not be called statically in %s on line %d
19-
20-
Fatal error: Uncaught Error: Non-static method Foo::__construct() cannot be called statically in %s:%d
18+
Fatal error: Uncaught Error: Non-static method Foo::get() cannot be called statically in %s:%d
2119
Stack trace:
22-
#0 %s(%d): Foo::get()
23-
#1 {main}
20+
#0 {main}
2421
thrown in %s on line %d

Zend/tests/bug47054.phpt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,10 @@ $c->s();
2424

2525
get_called_class();
2626

27-
D::m();
28-
2927
?>
3028
--EXPECTF--
3129
Called class: D
3230
Called class: C
3331
Called class: C
3432

3533
Warning: get_called_class() called from outside a class in %s on line %d
36-
37-
Deprecated: Non-static method D::m() should not be called statically in %s on line %d
38-
39-
Fatal error: Uncaught Error: Using $this when not in object context in %s:%d
40-
Stack trace:
41-
#0 %s(%d): D::m()
42-
#1 {main}
43-
thrown in %s on line %d

Zend/tests/bug48533.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ $x->a();
2626
$x->b();
2727
$x->c();
2828
$x::a();
29-
$x::b();
3029
$x::c();
30+
$x::b();
3131

3232
?>
3333
--EXPECTF--
3434
string(9) "__call::a"
3535
int(2)
3636
string(9) "__call::c"
3737
string(15) "__callStatic::a"
38-
39-
Deprecated: Non-static method foo::b() should not be called statically in %s on line %d
40-
int(2)
4138
string(15) "__callStatic::c"
39+
40+
Fatal error: Uncaught Error: Non-static method foo::b() cannot be called statically in %s:%d
41+
Stack trace:
42+
#0 {main}
43+
thrown in %s on line %d

Zend/tests/bug74408.phpt

Lines changed: 0 additions & 34 deletions
This file was deleted.

Zend/tests/call_static_006.phpt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,15 @@ Testing __callStatic
44
<?php
55

66
class foo {
7-
public function aa() {
8-
print "ok\n";
9-
}
107
static function __callstatic($a, $b) {
118
var_dump($a);
129
}
1310
}
1411

15-
foo::aa();
16-
17-
$b = 'AA';
18-
foo::$b();
19-
2012
foo::__construct();
2113

2214
?>
2315
--EXPECTF--
24-
Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d
25-
ok
26-
27-
Deprecated: Non-static method foo::aa() should not be called statically in %s on line %d
28-
ok
29-
3016
Fatal error: Uncaught Error: Cannot call constructor in %s:%d
3117
Stack trace:
3218
#0 {main}

0 commit comments

Comments
 (0)