Skip to content

Commit 6ef9216

Browse files
committed
Finish PHP 4 constructor deprecation
1 parent db76b70 commit 6ef9216

Some content is hidden

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

53 files changed

+138
-73
lines changed

Zend/tests/bug31177-2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ Bug #31177 (memory corruption because of incorrect refcounting)
33
--FILE--
44
<?php
55
class foo {
6-
function foo($n=0) {
6+
function __construct($n=0) {
77
if($n) throw new Exception("new");
88
}
99
}
1010
$x = new foo();
1111
try {
12-
$y=$x->foo(1);
12+
$y=$x->__construct(1);
1313
} catch (Exception $e) {
1414
var_dump($x);
1515
}

Zend/tests/bug38942.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class bar extends foo {
1010
}
1111
print_r(get_class_methods("bar"));
1212
?>
13-
--EXPECT--
13+
--EXPECTF--
14+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
1415
Array
1516
(
1617
[0] => foo

Zend/tests/bug39127.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ var_dump(is_callable(array($b,"__construct")));
1414
echo "Done\n";
1515
?>
1616
--EXPECTF--
17+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
1718
string(13) "a::a() called"
1819
bool(true)
1920
bool(false)

Zend/tests/bug40784.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ $b = new B;
1919
echo "Done\n";
2020
?>
2121
--EXPECTF--
22+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
2223
I'm A
2324
I'm A
2425
Done

Zend/tests/bug43323.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,6 @@ abstract class bar {
99
class foo extends bar {
1010
}
1111
--EXPECTF--
12+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bar has a deprecated constructor in %s on line %d
13+
1214
Fatal error: Class foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (bar::bar) in %sbug43323.php on line 7

Zend/tests/bug46381.phpt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
--TEST--
22
Bug #46381 (wrong $this passed to internal methods causes segfault)
3-
--SKIPIF--
4-
<?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?>
53
--FILE--
64
<?php
75

86
class test {
9-
public function test() {
7+
public function method() {
108
return ArrayIterator::current();
119
}
1210
}
1311
$test = new test();
14-
$test->test();
12+
$test->method();
1513

1614
echo "Done\n";
1715
?>

Zend/tests/bug47343.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class A
2020

2121
class B
2222
{
23-
public function B($A)
23+
public function __construct($A)
2424
{
2525
$this->A = $A;
2626
}

Zend/tests/bug48215_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class a {
88
}
99
class b extends a {}
1010
class c extends b {
11-
function C() {
11+
function __construct() {
1212
b::b();
1313
}
1414
}

Zend/tests/bug50261.phpt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class testClass2 extends testClass {
3030
new testClass2;
3131

3232
?>
33-
--EXPECT--
33+
--EXPECTF--
34+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; testClass has a deprecated constructor in %s on line %d
3435
testClass::testClass (1)
3536
testClass::testClass (2)
3637
testClass::testClass (3)

Zend/tests/bug52051.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ class C extends B {
2222
new C();
2323

2424
?>
25-
--EXPECT--
25+
--EXPECTF--
26+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AA has a deprecated constructor in %s on line %d
27+
28+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CC has a deprecated constructor in %s on line %d
29+
30+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
31+
32+
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
2633
foo
2734
bar

0 commit comments

Comments
 (0)