#33239 [NEW]: scope of function/classes definition in inclusion
| From: | pythonboy at gmail dot com | Date: | Fri, 03 Jun 2005 20:08:35 +0000 |
| Subject: | #33239 [NEW]: scope of function/classes definition in inclusion | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969368416@lists.php.net to get a copy of this message | ||
From: pythonboy at gmail dot com
Operating system: any
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: scope of function/classes definition in inclusion
Description:
------------
When a file contains function/class definition and this file is included
inside another function/method the definition has global scope
Reproduce code:
---------------
Example
function wilma()
{
//fred.php contains fred() function definition
include('fred.php') ;
}
wilma() ;
//prints "yabba-yabba-doo"
echo fred() ;
Expected result:
----------------
As to the manual...
http://www.php.net/manual/en/function.include.php
Fatal error: Call to undefined function: fred()
Actual result:
--------------
fred() is defined in global scope
--
Edit bug report at http://bugs.php.net/?id=33239&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33239&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33239&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33239&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33239&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33239&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33239&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33239&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33239&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33239&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33239&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33239&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33239&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33239&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33239&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33239&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33239&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33239&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33239&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33239&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33239&r=mysqlcfg