From:             andyincolorado at gmx dot net
Operating system: Any
PHP version:      6CVS-2008-09-01 (CVS)
PHP Bug Type:     Feature/Change Request
Bug description:  Undefined variable should cause an error

Description:
------------
In all PHP version I've tested so far, using an undefined variable (see
code below) will cause a notice to be thrown. However, it would be better
to throw an error, since using an undefined variable can cause
unpredictable results or (as in my case) data loss. Same would go to the
"undefined index" notice for arrays.
This could either be done by using an option, allowing users to turn it
off or without an option, since PHP6 changes so many things that developers
will have to adapt their scripts.

Reproduce code:
---------------
// Note that $bar isn't defined anywhere in the script
$foo = $bar + 5;

Expected result:
----------------
An error message that causes the script to cease running.

Actual result:
--------------
A notice ("Undefined variable $foo...") is thrown.

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

Reply via email to