php-src/ext/reflection/tests/bug37816.phpt
2007-04-12 12:43:54 +00:00

31 lines
476 B
PHP
Executable File

--TEST--
Bug #37816 (ReflectionProperty does not throw exception when accessing protected attribute)
--SKIPIF--
<?php extension_loaded('reflection') or die('skip'); ?>
--FILE--
<?php
class TestClass
{
protected $p = 2;
}
$o = new TestClass;
$r = new ReflectionProperty($o, 'p');
try
{
$x = $r->getValue($o);
}
catch (Exception $e)
{
echo 'Caught: ' . $e->getMessage() . "\n";
}
?>
===DONE===
--EXPECTF--
Caught: Cannot access non-public member TestClass::p
===DONE===