mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
d30cd7d7e7
Closes GH-5590
27 lines
398 B
PHP
27 lines
398 B
PHP
--TEST--
|
|
Bug #37816 (ReflectionProperty does not throw exception when accessing protected attribute)
|
|
--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";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Caught: Cannot access non-public property TestClass::$p
|