From:             oorza2k5 at gmail dot com
Operating system: Irrelevant
PHP version:      5.3.0
PHP Bug Type:     Scripting Engine problem
Bug description:  Class members with the same name ought to raise an E_STRICT 
error or notice.

Description:
------------
When you store a closure as a class property, while having a method with
the same name, it's unclear (I don't think this is documented anywhere)
what $obj->name($arg) will do.  If this is the case, a warning about code
ambiguity ought to be raised.  

This is a potentially very confusing scenario, perhaps an E_STRICT error
ought to be raised whenever two class members share the same name,
regardless of whether a property contains a closure or not.

Reproduce code:
---------------
class foo {
  public $bar;
  public function bar() {
    echo "Inside a method!";
  }
}

$obj = new foo();
$obj->bar = function() { echo "Inside a closure!"; };

$obj->bar();



Expected result:
----------------
Notice: ....

Inside a method!

Actual result:
--------------
Inside a method!

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

Reply via email to