summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-04-01 13:06:38 +0800
committerXinchen Hui <laruence@php.net>2015-04-01 13:06:38 +0800
commitfd0baec2e9afbd6706f16c26d32ec038c192d7e5 (patch)
tree0ba31b7242cc63451c84fb9fbb1172bffa9314e9 /tests
parentaf812eac4c9727bdfb90cac1a35ab53d741cb7eb (diff)
parented772e1a998ca72fc1c354fcefc05149ca7a2a56 (diff)
downloadphp-git-fd0baec2e9afbd6706f16c26d32ec038c192d7e5.tar.gz
Merge branch 'master' of https://git.php.net/repository/php-src
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/clone_006.phpt2
-rw-r--r--tests/classes/ctor_dtor.phpt8
-rw-r--r--tests/classes/ctor_name_clash.phpt1
-rw-r--r--tests/classes/dereferencing_001.phpt4
-rw-r--r--tests/classes/final_ctor1.phpt1
-rw-r--r--tests/classes/final_ctor2.phpt1
-rw-r--r--tests/classes/final_ctor3.phpt2
-rw-r--r--tests/classes/inheritance_002.phpt19
-rw-r--r--tests/classes/inheritance_005.phpt1
-rw-r--r--tests/classes/inheritance_007.phpt1
-rw-r--r--tests/classes/object_reference_001.phpt2
-rw-r--r--tests/lang/028.phpt2
-rw-r--r--tests/lang/030.phpt2
-rw-r--r--tests/lang/035.phpt2
-rw-r--r--tests/lang/bug20175.phpt4
-rw-r--r--tests/lang/bug21849.phpt2
-rw-r--r--tests/lang/bug21961.phpt4
-rw-r--r--tests/lang/bug23489.phpt2
-rw-r--r--tests/lang/bug24926.phpt2
-rw-r--r--tests/lang/bug27535.phpt2
-rw-r--r--tests/lang/error_2_exception_001.phpt2
21 files changed, 39 insertions, 27 deletions
diff --git a/tests/classes/clone_006.phpt b/tests/classes/clone_006.phpt
index de22fec151..15f0a5ec52 100644
--- a/tests/classes/clone_006.phpt
+++ b/tests/classes/clone_006.phpt
@@ -10,7 +10,7 @@ error_reporting=2047
class MyCloneable {
static $id = 0;
- function MyCloneable() {
+ function __construct() {
$this->id = self::$id++;
}
diff --git a/tests/classes/ctor_dtor.phpt b/tests/classes/ctor_dtor.phpt
index ea6813cc96..6af863e576 100644
--- a/tests/classes/ctor_dtor.phpt
+++ b/tests/classes/ctor_dtor.phpt
@@ -6,7 +6,7 @@ ZE2 The new constructor/destructor is called
<?php
class early {
- function early() {
+ function __construct() {
echo __CLASS__ . "::" . __FUNCTION__ . "\n";
}
function __destruct() {
@@ -24,7 +24,7 @@ class late {
}
$t = new early();
-$t->early();
+$t->__construct();
unset($t);
$t = new late();
//unset($t); delay to end of script
@@ -32,8 +32,8 @@ $t = new late();
echo "Done\n";
?>
--EXPECTF--
-early::early
-early::early
+early::__construct
+early::__construct
early::__destruct
late::__construct
Done
diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt
index 1a1d6fa511..e6518775ff 100644
--- a/tests/classes/ctor_name_clash.phpt
+++ b/tests/classes/ctor_name_clash.phpt
@@ -18,5 +18,6 @@ $obj = new derived();
$obj->base();
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d
base::base
derived::base
diff --git a/tests/classes/dereferencing_001.phpt b/tests/classes/dereferencing_001.phpt
index dd2aba78e5..886baeb288 100644
--- a/tests/classes/dereferencing_001.phpt
+++ b/tests/classes/dereferencing_001.phpt
@@ -6,7 +6,7 @@ ZE2 dereferencing of objects from methods
<?php
class Name {
- function Name($_name) {
+ function __construct($_name) {
$this->name = $_name;
}
@@ -18,7 +18,7 @@ class Name {
class Person {
private $name;
- function person($_name, $_address) {
+ function __construct($_name, $_address) {
$this->name = new Name($_name);
}
diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt
index ebfa08081e..acf20918fd 100644
--- a/tests/classes/final_ctor1.phpt
+++ b/tests/classes/final_ctor1.phpt
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d
Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt
index 905337b408..37fcac29a9 100644
--- a/tests/classes/final_ctor2.phpt
+++ b/tests/classes/final_ctor2.phpt
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
?>
--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d
Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d
diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt
index 3a61ecf902..b34996c979 100644
--- a/tests/classes/final_ctor3.phpt
+++ b/tests/classes/final_ctor3.phpt
@@ -10,4 +10,6 @@ Ensure implicit final inherited old-style constructor cannot be overridden.
}
?>
--EXPECTF--
+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
+
Fatal error: Cannot override final method A::A() in %s on line %d
diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt
index 0b8cf2650e..7669f735e5 100644
--- a/tests/classes/inheritance_002.phpt
+++ b/tests/classes/inheritance_002.phpt
@@ -17,13 +17,13 @@ class Child_php4 extends Base_php4 {
}
}
-class Base_php7 {
+class Base_php5 {
function __construct() {
var_dump('Base constructor');
}
}
-class Child_php7 extends Base_php7 {
+class Child_php5 extends Base_php5 {
function __construct() {
var_dump('Child constructor');
parent::__construct();
@@ -37,7 +37,7 @@ class Child_mx1 extends Base_php4 {
}
}
-class Child_mx2 extends Base_php7 {
+class Child_mx2 extends Base_php5 {
function Child_mx2() {
var_dump('Child constructor');
parent::__construct();
@@ -47,8 +47,8 @@ class Child_mx2 extends Base_php7 {
echo "### PHP 4 style\n";
$c4= new Child_php4();
-echo "### PHP 7 style\n";
-$c5= new Child_php7();
+echo "### PHP 5 style\n";
+$c5= new Child_php5();
echo "### Mixed style 1\n";
$cm= new Child_mx1();
@@ -56,11 +56,16 @@ $cm= new Child_mx1();
echo "### Mixed style 2\n";
$cm= new Child_mx2();
?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d
### PHP 4 style
string(17) "Child constructor"
string(16) "Base constructor"
-### PHP 7 style
+### PHP 5 style
string(17) "Child constructor"
string(16) "Base constructor"
### Mixed style 1
diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt
index 8990264d92..7399bf1168 100644
--- a/tests/classes/inheritance_005.phpt
+++ b/tests/classes/inheritance_005.phpt
@@ -41,6 +41,7 @@ Check for inherited old-style constructor.
var_dump(is_callable(array($c, "C")));
?>
--EXPECTF--
+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
About to construct new B:
In A::A
Is B::B() callable?
diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt
index 46100449c4..c87fbde344 100644
--- a/tests/classes/inheritance_007.phpt
+++ b/tests/classes/inheritance_007.phpt
@@ -18,6 +18,7 @@ $b->b();
?>
--EXPECTF--
+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
array(2) {
[0]=>
object(ReflectionMethod)#%d (2) {
diff --git a/tests/classes/object_reference_001.phpt b/tests/classes/object_reference_001.phpt
index 74acb5de13..f114d1aa95 100644
--- a/tests/classes/object_reference_001.phpt
+++ b/tests/classes/object_reference_001.phpt
@@ -8,7 +8,7 @@ ZE2 object references
class Foo {
public $name;
- function Foo() {
+ function __construct() {
$this->name = "I'm Foo!\n";
}
}
diff --git a/tests/lang/028.phpt b/tests/lang/028.phpt
index bd4525ee60..2c51b79cb2 100644
--- a/tests/lang/028.phpt
+++ b/tests/lang/028.phpt
@@ -28,7 +28,7 @@ function dafna()
class dafna_class {
- function dafna_class() {
+ function __construct() {
$this->myname = "Dafna";
}
function GetMyName() {
diff --git a/tests/lang/030.phpt b/tests/lang/030.phpt
index 758369bf08..9ee40ea5aa 100644
--- a/tests/lang/030.phpt
+++ b/tests/lang/030.phpt
@@ -3,7 +3,7 @@ $this in constructor test
--FILE--
<?php
class foo {
- function foo($name) {
+ function __construct($name) {
$GLOBALS['List']= &$this;
$this->Name = $name;
$GLOBALS['List']->echoName();
diff --git a/tests/lang/035.phpt b/tests/lang/035.phpt
index 9472999f47..a5e3a7f4cc 100644
--- a/tests/lang/035.phpt
+++ b/tests/lang/035.phpt
@@ -5,7 +5,7 @@ ZE2: set_exception_handler()
--FILE--
<?php
class MyException extends Exception {
- function MyException($_error) {
+ function __construct($_error) {
$this->error = $_error;
}
diff --git a/tests/lang/bug20175.phpt b/tests/lang/bug20175.phpt
index bee3688d66..a3fdd297e1 100644
--- a/tests/lang/bug20175.phpt
+++ b/tests/lang/bug20175.phpt
@@ -95,7 +95,7 @@ $oop_global = 0;
class oop_class {
var $oop_name;
- function oop_class() {
+ function __construct() {
global $oop_global;
echo "oop_class()\n";
$this->oop_name = 'oop:' . ++$oop_global;
@@ -105,7 +105,7 @@ class oop_class {
class oop_test {
static $oop_value;
- function oop_test() {
+ function __construct() {
echo "oop_test()\n";
}
diff --git a/tests/lang/bug21849.phpt b/tests/lang/bug21849.phpt
index 30b311320b..2ce99769d9 100644
--- a/tests/lang/bug21849.phpt
+++ b/tests/lang/bug21849.phpt
@@ -5,7 +5,7 @@ Bug #21849 (self::constant doesn't work as method's default parameter)
class foo {
const bar = "fubar\n";
- function foo($arg = self::bar) {
+ function __construct($arg = self::bar) {
echo $arg;
}
}
diff --git a/tests/lang/bug21961.phpt b/tests/lang/bug21961.phpt
index 24581d663e..9b7199208d 100644
--- a/tests/lang/bug21961.phpt
+++ b/tests/lang/bug21961.phpt
@@ -8,7 +8,7 @@ Bug #21961 (get_parent_class() segfault)
class man
{
public $name, $bars;
- function man()
+ function __construct()
{
$this->name = 'Mr. X';
$this->bars = array();
@@ -29,7 +29,7 @@ class bar extends man
{
public $name;
- function bar($w)
+ function __construct($w)
{
$this->name = $w;
}
diff --git a/tests/lang/bug23489.phpt b/tests/lang/bug23489.phpt
index 645bb1b7df..c8535c5123 100644
--- a/tests/lang/bug23489.phpt
+++ b/tests/lang/bug23489.phpt
@@ -3,7 +3,7 @@ Bug #23489 (ob_start() is broken with method callbacks)
--FILE--
<?php
class Test {
- function Test() {
+ function __construct() {
ob_start(
array(
$this, 'transform'
diff --git a/tests/lang/bug24926.phpt b/tests/lang/bug24926.phpt
index 3d2cc7008b..8f853dba47 100644
--- a/tests/lang/bug24926.phpt
+++ b/tests/lang/bug24926.phpt
@@ -9,7 +9,7 @@ class foo {
public $functions = array();
- function foo()
+ function __construct()
{
$function = create_function('', 'return "FOO\n";');
print($function());
diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt
index a6ceae7463..29fd033469 100644
--- a/tests/lang/bug27535.phpt
+++ b/tests/lang/bug27535.phpt
@@ -12,7 +12,7 @@ class Class2
{
public $storage = '';
- function Class2()
+ function __construct()
{
$this->storage = new Class1();
diff --git a/tests/lang/error_2_exception_001.phpt b/tests/lang/error_2_exception_001.phpt
index 61f45d47d5..9596ba2331 100644
--- a/tests/lang/error_2_exception_001.phpt
+++ b/tests/lang/error_2_exception_001.phpt
@@ -6,7 +6,7 @@ ZE2 errors caught as exceptions
<?php
class MyException extends Exception {
- function MyException($_errno, $_errmsg) {
+ function __construct($_errno, $_errmsg) {
$this->errno = $_errno;
$this->errmsg = $_errmsg;
}