1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/reflection/tests/bug39067.phpt
2008-05-24 13:34:22 +00:00

46 lines
742 B
PHP

--TEST--
Bug #39067 (getDeclaringClass() and private properties)
--FILE--
<?php
class A {
private $x;
}
class B extends A {
private $x;
}
class C extends B {
private $x;
}
$rc = new ReflectionClass('C');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
$rc = new ReflectionClass('B');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
$rc = new ReflectionClass('A');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
class Test {
private $x;
}
class Test2 extends Test {
public $x;
}
$rc = new ReflectionClass('Test2');
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
echo "Done\n";
?>
--EXPECTF--
string(1) "C"
string(1) "B"
string(1) "A"
string(5) "Test2"
Done