Bug #52900 [NEW]: Protected instance method called by static method of the same class
| From: | e dot visciola at xaos dot it | Date: | Tue, 21 Sep 2010 14:02:01 +0000 |
| Subject: | Bug #52900 [NEW]: Protected instance method called by static method of the same class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154532@lists.php.net to get a copy of this message | ||
From:
Operating system: WIN & OSX
PHP version: Irrelevant
Package: Class/Object related
Bug Type: Bug
Bug description:Protected instance method called by static method of the same class
Description:
------------
When I call a protected instance method of an object inside a class method
of "the same type" I'd like to have an error.
The example explain:
Test script:
---------------
class A {
protected function instanceMethod()
{
echo 'Instance method called, but it is not right because instance
method is protected<br />';
}
public static function staticMethod()
{
echo 'Static method called<br />';
$a = new A();
$a->instanceMethod();
}
}
A::staticMethod();
Expected result:
----------------
That was generated an error to access the protected method
Actual result:
--------------
Static method called
Instance method called, but it is not right because instance method is
protected
--
Edit bug report at http://bugs.php.net/bug.php?id=52900&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52900&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52900&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52900&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52900&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52900&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52900&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52900&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52900&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52900&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52900&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52900&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52900&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52900&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52900&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52900&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52900&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52900&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52900&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52900&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52900&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52900&r=mysqlcfg