mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
tests
This commit is contained in:
parent
389b1abc16
commit
b03b79c985
57
Zend/tests/bug29689.phpt
Normal file
57
Zend/tests/bug29689.phpt
Normal file
@ -0,0 +1,57 @@
|
||||
--TEST--
|
||||
Bug #29689 (default value of protected member overrides default value of private)
|
||||
--FILE--
|
||||
<?php
|
||||
class foo {
|
||||
private $foo = 'foo';
|
||||
|
||||
function printFoo()
|
||||
{
|
||||
echo __CLASS__, ': ', $this->foo, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
protected $foo = 'bar';
|
||||
|
||||
function printFoo()
|
||||
{
|
||||
parent::printFoo();
|
||||
echo __CLASS__, ': ', $this->foo, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class baz extends bar {
|
||||
protected $foo = 'baz';
|
||||
}
|
||||
|
||||
class bar2 extends foo {
|
||||
function printFoo()
|
||||
{
|
||||
parent::printFoo();
|
||||
echo __CLASS__, ': ', $this->foo, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
class baz2 extends bar2 {
|
||||
protected $foo = 'baz2';
|
||||
}
|
||||
|
||||
$bar = new bar;
|
||||
$bar->printFoo();
|
||||
echo "---\n";
|
||||
$baz = new baz();
|
||||
$baz->printFoo();
|
||||
echo "---\n";
|
||||
$baz = new baz2();
|
||||
$baz->printFoo();
|
||||
?>
|
||||
--EXPECT--
|
||||
foo: foo
|
||||
bar: bar
|
||||
---
|
||||
foo: foo
|
||||
bar: baz
|
||||
---
|
||||
foo: foo
|
||||
bar2: baz2
|
36
Zend/tests/bug30451.phpt
Normal file
36
Zend/tests/bug30451.phpt
Normal file
@ -0,0 +1,36 @@
|
||||
--TEST--
|
||||
Bug #30451 (static properties permissions broken)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
|
||||
protected static $property = TRUE;
|
||||
|
||||
protected static function method() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
|
||||
public function __construct() {
|
||||
|
||||
var_dump(self::method());
|
||||
var_dump(parent::method());
|
||||
|
||||
var_dump(self::$property);
|
||||
var_dump(parent::$property);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new B;
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
||||
bool(true)
|
Loading…
Reference in New Issue
Block a user