ID: 29104 Updated by: [EMAIL PROTECTED] Reported By: tomas_matousek at hotmail dot com Status: Open Bug Type: Zend Engine 2 problem -Operating System: WinXP +Operating System: * -PHP Version: 5.0.0RC3 +PHP Version: 5.0.0 -Assigned To: +Assigned To: Andi New Comment:
PHP does not support nested functions. Still we need to disable this. Previous Comments: ------------------------------------------------------------------------ [2004-07-13 21:42:52] tomas_matousek at hotmail dot com PHP supports declaring functions "inline", i.e. almost anywhere in a code. Such function is declared as global wherever it is declared. Hence, I don't see any ambiguity if a function is declared inside a method. PHP doesn't support adding new methods into existing class. That's why a function declared in method can only be a global one. ------------------------------------------------------------------------ [2004-07-13 17:45:57] Jason at hybd dot net >From what I gather, like most languages, PHP doesn't support 'nested' methods. (And therefore I doubt this is a bug) Where you are calling f() is ambigous. As far as PHP is concerned f() is probably a global function and not a method embedded inside a::g(). ------------------------------------------------------------------------ [2004-07-12 09:41:23] tomas_matousek at hotmail dot com 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 this bug report at http://bugs.php.net/?id=29104&edit=1