From: addw at phcomp dot co dot uk Operating system: any PHP version: 5.2.0RC5 PHP Bug Type: Variables related Bug description: Need to force variables to be declared
Description: ------------ Could we not use 'var' to declare variables outside of functions and have a config option or file related pragma that made not declaring a variable an error ? Yes: there would be a problem with existing code, so why not force variable declaration iff/after a 'var' declaration is seen. If you really want to do it properly, then we could use 'private' or 'static' to declare variables with the scope of the file that they are declared in (like in C). The most recent bug reference that I can find for this is: 14285 (Nov 2001). This is a MUST HAVE, it is the single most dangerous mis-feature of PHP. Don't get me wrong - I like PHP, but just hanker after perl's use strict - great at pointing out typeos. -- Edit bug report at http://bugs.php.net/?id=39091&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39091&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39091&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39091&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39091&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39091&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39091&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39091&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39091&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39091&r=support Expected behavior: http://bugs.php.net/fix.php?id=39091&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39091&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39091&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39091&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39091&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39091&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39091&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39091&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39091&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39091&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39091&r=mysqlcfg
