mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
8d00385871
Per RFC https://wiki.php.net/rfc/reclassify_e_strict While reviewing this, found that there are still three E_STRICTs left in libraries - need to discuss those.
49 lines
958 B
PHP
49 lines
958 B
PHP
--TEST--
|
|
ZE2 object cloning, 6
|
|
--SKIPIF--
|
|
<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
|
|
--INI--
|
|
error_reporting=2047
|
|
--FILE--
|
|
<?php
|
|
|
|
class MyCloneable {
|
|
static $id = 0;
|
|
|
|
function __construct() {
|
|
$this->id = self::$id++;
|
|
}
|
|
|
|
function __clone() {
|
|
$this->address = "New York";
|
|
$this->id = self::$id++;
|
|
}
|
|
}
|
|
|
|
$original = new MyCloneable();
|
|
|
|
$original->name = "Hello";
|
|
$original->address = "Tel-Aviv";
|
|
|
|
echo $original->id . "\n";
|
|
|
|
$clone = clone $original;
|
|
|
|
echo $clone->id . "\n";
|
|
echo $clone->name . "\n";
|
|
echo $clone->address . "\n";
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Notice: Accessing static property MyCloneable::$id as non static in %s on line %d
|
|
|
|
Notice: Accessing static property MyCloneable::$id as non static in %s on line %d
|
|
0
|
|
|
|
Notice: Accessing static property MyCloneable::$id as non static in %s on line %d
|
|
|
|
Notice: Accessing static property MyCloneable::$id as non static in %s on line %d
|
|
1
|
|
Hello
|
|
New York
|