mirror of
https://github.com/php/php-src.git
synced 2024-10-20 07:53:58 +00:00
29 lines
409 B
Plaintext
29 lines
409 B
Plaintext
|
--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";
|
||
|
}
|
||
|
|
||
|
?>
|
||
|
===DONE===
|
||
|
--EXPECTF--
|
||
|
Caught: Cannot access non-public member TestClass::p
|
||
|
===DONE===
|