#38824 [NEW]: settype() should throw a Notice on uninitialized variables

From: Date: Thu, 14 Sep 2006 11:07:14 +0000
Subject: #38824 [NEW]: settype() should throw a Notice on uninitialized variables
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-102162@lists.php.net to get a copy of this message
From: tklingenberg at lastflood dot com Operating system: win32 PHP version: 5.1.6 PHP Bug Type: Feature/Change Request Bug description: settype() should throw a Notice on uninitialized variables Description: ------------ In case a program uses an uninitialized variable passed to settype(), it should throw a Notice, compareable to echo; intval() and other variable related functions. Even if PHP does everything right ($var is a variable you can change the type of), for the PHP User, it's highly possible she/he made an error and typed in the wrong variable name. Afterwards the type of the variable is unchecked, which can lead to even more critical errors. All this is unnoticed because PHP does not throw a NOTICE. Reproduce code: --------------- <?php $r = settype($var, "float"); ?> Expected result: ---------------- It should throw a Notice Actual result: -------------- No Notice is giving that $var is not initialized. -- Edit bug report at http://bugs.php.net/?id=38824&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38824&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38824&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38824&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38824&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38824&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38824&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38824&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38824&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38824&r=support Expected behavior: http://bugs.php.net/fix.php?id=38824&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38824&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38824&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38824&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38824&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38824&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38824&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38824&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38824&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38824&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38824&r=mysqlcfg

« previous php.bugs (#102162) next »