From:             karibu at gmx dot net
Operating system: MacOS X, MorphOS
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  position of define() in source matters

Description:
------------
When I *call* a function which uses a define before this define is
actually defined in the source it appears in the function to be undefined.


I didn't found this behavoir documented (not in the english or german
section) but it would probably very useful as it quickly can lead to
unexpected problems w/o instantly possible to detect why (in a script of
mine it caused busylooping f.ex.).

Reproduce code:
---------------
<?php

printfoobar();
exit;

define(FOO, 'bar');

function printfoobar()
{
    echo FOO;
}

?>   


Expected result:
----------------
bar

Actual result:
--------------
FOO

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

Reply via email to