ID: 38821 User updated by: tklingenberg at lastflood dot com Reported By: tklingenberg at lastflood dot com -Status: Bogus +Status: Closed Bug Type: Variables related Operating System: win32 PHP Version: 5.1.6 New Comment:
I close this on behalf my own, because this really is BOGUS: In PHP there is no such thing like a nonexisting variable. So infact, it's not settype() that creates the variable, it's PHP. Previous Comments: ------------------------------------------------------------------------ [2006-09-14 09:54:19] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php bool settype ( mixed &var, string type ) ------------------------------------------------------------------------ [2006-09-14 09:51:04] tklingenberg at lastflood dot com Description: ------------ settype() needs a variable passed by reference. if this variable is not defined/set, it does not throw an error. instead, and that is the bug per se, settype creates the variable passed "by reference". Reproduce code: --------------- <? /* $var does not exsits, this throws an error */ var_dump($var); /* settype should work on existing vars only (by &reference) */ $r = settype($var, "string"); /* $var does exist now */ var_dump($var); ?> Expected result: ---------------- <br /> <b>Notice</b>: Undefined variable: var in <b>test.php</b> on line <b>3</b><br /> NULL <br /> <b>Notice</b>: Undefined variable: var in <b>test.php</b> on line <b>6</b><br /> NULL Actual result: -------------- <br /> <b>Notice</b>: Undefined variable: var in <b>test.php</b> on line <b>3</b><br /> NULL string(0) "" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38821&edit=1
