File:
[ELWIX - Embedded LightWeight unIX -] /
embedaddon /
php /
ext /
reflection /
tests /
ReflectionProperty_constructor_variation1.phpt
Revision
1.1.1.1 (vendor branch):
download - view:
text,
annotated -
select for diffs -
revision graph
Tue Feb 21 23:48:00 2012 UTC (13 years, 1 month ago) by
misho
Branches:
php,
MAIN
CVS tags:
v5_4_3elwix,
v5_4_29p0,
v5_4_29,
v5_4_20p0,
v5_4_20,
v5_4_17p0,
v5_4_17,
v5_3_10,
HEAD
php
--TEST--
ReflectionProperty::__construct(): ensure inherited private props can't be accessed through ReflectionProperty.
--FILE--
<?php
class C {
private $p = 1;
static function testFromC() {
try {
$rp = new ReflectionProperty("D", "p");
var_dump($rp);
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
class D extends C{
static function testFromD() {
try {
$rp = new ReflectionProperty("D", "p");
var_dump($rp);
} catch (Exception $e) {
echo $e->getMessage();
}
}
}
echo "--> Reflect inherited private from global scope:\n";
try {
$rp = new ReflectionProperty("D", "p");
var_dump($rp);
} catch (Exception $e) {
echo $e->getMessage();
}
echo "\n\n--> Reflect inherited private from declaring scope:\n";
C::testFromC();
echo "\n\n--> Reflect inherited private from declaring scope via subclass:\n";
D::testFromC();
echo "\n\n--> Reflect inherited private from subclass:\n";
D::testFromD();
?>
--EXPECTF--
--> Reflect inherited private from global scope:
Property D::$p does not exist
--> Reflect inherited private from declaring scope:
Property D::$p does not exist
--> Reflect inherited private from declaring scope via subclass:
Property D::$p does not exist
--> Reflect inherited private from subclass:
Property D::$p does not exist
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>