2006-10-06 17:35:32 +00:00
|
|
|
--TEST--
|
|
|
|
Bug #39067 (getDeclaringClass() and private properties)
|
2007-04-12 12:29:48 +00:00
|
|
|
--SKIPIF--
|
|
|
|
<?php extension_loaded('reflection') or die('skip'); ?>
|
2006-10-06 17:35:32 +00:00
|
|
|
--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());
|
|
|
|
|
2006-10-06 18:03:19 +00:00
|
|
|
class Test {
|
|
|
|
private $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Test2 extends Test {
|
|
|
|
public $x;
|
|
|
|
}
|
|
|
|
|
|
|
|
$rc = new ReflectionClass('Test2');
|
|
|
|
var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
|
|
|
|
|
2006-10-06 17:35:32 +00:00
|
|
|
echo "Done\n";
|
|
|
|
?>
|
|
|
|
--EXPECTF--
|
|
|
|
string(1) "C"
|
|
|
|
string(1) "B"
|
|
|
|
string(1) "A"
|
2006-10-06 18:03:19 +00:00
|
|
|
string(5) "Test2"
|
2006-10-06 17:35:32 +00:00
|
|
|
Done
|