PHP 4.0 Bug #8139 Updated: NULL and isset

From: Date: Thu, 14 Dec 2000 10:07:04 +0000
Subject: PHP 4.0 Bug #8139 Updated: NULL and isset
Groups: php.dev 
Request: Send a blank email to php-dev+get-41313@lists.php.net to get a copy of this message
ID: 8139 Updated by: stas Reported By: richard.heyes@heyes-computing.net Old-Status: Open Status: Closed Bug Type: Scripting Engine problem Assigned To: Comments: From current Zend code I see that no operation that should write variable (including passing by reference) won't generate "undefined" waring. This seems logical - if you write it, why you care if it wasn't set before? So I'd close it, since it's not a bug, but intended behaviour. If you disagree, submit a feature request. Previous Comments: --------------------------------------------------------------------------- [2000-12-07 04:22:20] richard.heyes@heyes-computing.net No idea. Though I do know of people who use that method to set variables, so their answer would be a resounding no. :) (EG: <?php function mconnect(&$link){ $link = mysql_connect(); } mconnect($db); ?> ) --------------------------------------------------------------------------- [2000-12-06 13:18:04] joey@php.net The question is: should passing an unset variable by reference generate a warning? --------------------------------------------------------------------------- [2000-12-06 12:57:39] richard.heyes@heyes-computing.net <?php function foo(&$bar){ return TRUE; } foo($bar); print($bar); if(!isset($bar)) print('Bar is not set!'); ?> With notices turned on (error_reporting) the call to print($bar) does not throw an error. However the bit below it runs the print() call. So if it's not set, the first print should throw an error regarding the unset $bar. Seems very contradictory. FWIW the type of $bar after the call to foo() is NULL. --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8139

« previous php.dev (#41313) next »