Edit report at http://bugs.php.net/bug.php?id=52386&edit=1

 ID:               52386
 User updated by:  laszlo dot janszky at gmail dot com
 Reported by:      laszlo dot janszky at gmail dot com
 Summary:          ReflectionClass scope problem
 Status:           Bogus
 Type:             Bug
 Package:          Reflection related
 Operating System: xp
 PHP Version:      5.3.2

 New Comment:

Ok.


Previous Comments:
------------------------------------------------------------------------
[2010-07-22 05:01:45] ahar...@php.net

That's by design -- reflection's not intended to provide a backdoor

around the usual access specification mechanism.

------------------------------------------------------------------------
[2010-07-21 13:16:16] laszlo dot janszky at gmail dot com

Description:
------------
Maybe it's not a bug, but I cannot call private or protected
methods from within a class by ReflectionClass.

Test script:
---------------
<?php

class
Test
{
	static public function
instance()
	{
		$class=new
ReflectionClass(get_called_class());
		return
$class->newInstanceArgs(func_get_args());
	}
	
	private
function
__construct()
	{}
}

Test::instance();

Expected result:
----------------
Create a new instance.

Actual result:
--------------
Fatal error: Uncaught exception 'ReflectionException'
with message 'Access to non-public constructor of class
Test'


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52386&edit=1

Reply via email to