From:             tomas_matousek at hotmail dot com
Operating system: WinXP
PHP version:      5.0.0RC3
PHP Bug Type:     Zend Engine 2 problem
Bug description:  Function declaration in method doesn't work

Description:
------------
Declaration of a function in a method doesn't work.
IMHO by declaring a function in a method one creates a function not a
method. It it was a method it would be possible to call it by $a->f().
That works neither.

See the code below:

Reproduce code:
---------------
class A
{ 
  function g() 
  { 
    echo "function g - begin\n";
    
    function f() 
    { 
      echo "function f\n";
    } 
    
    echo "function g - end\n";
  }
}

$a = new A;
$a->g();
f();            

Expected result:
----------------
function g - begin
function g - end
function f

Actual result:
--------------
function g - begin
function g - end

Fatal error:  Non-static method A::f() cannot be called statically ...



-- 
Edit bug report at http://bugs.php.net/?id=29104&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29104&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29104&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29104&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29104&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29104&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29104&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29104&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29104&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29104&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29104&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29104&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29104&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29104&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29104&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29104&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29104&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29104&r=float

Reply via email to