From:             agideonse at planet dot nl
Operating system: Irrelevant
PHP version:      5.2.4
PHP Bug Type:     Class/Object related
Bug description:  Static call of non static function inherets class

Description:
------------
When a function in a class is not declared static it can still be called
as a static method (no problem). When this is done from another class the
function seems to know the values from the class that it was called from.
It is not clarified in the manual why this should be the case ($this is
bound to class A, not class B) if this isn't a bug.

Reproduce code:
---------------
class A
{
   function __construct()
   {
      $this->name = "Class A";
   }

   function doeIets()
   {
      B::doeIetsAnders();
   }
}

class B
{
   function doeIetsAnders()
   {
      print_r($this);
   }
} 

Expected result:
----------------
In strict mode, there should be a warning that $this does not have a
value.

Actual result:
--------------
$this has te values of class A. 

-- 
Edit bug report at http://bugs.php.net/?id=42595&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42595&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42595&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42595&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42595&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42595&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42595&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42595&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42595&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42595&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42595&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42595&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42595&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42595&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42595&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42595&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42595&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42595&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42595&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42595&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42595&r=mysqlcfg

Reply via email to