RE: [PHP-DEV] PHP 4.0 Bug #8139 Updated: NULL and isset
| From: | Sam Liddicott | Date: | Thu, 07 Dec 2000 09:46:23 +0000 |
| Subject: | RE: [PHP-DEV] PHP 4.0 Bug #8139 Updated: NULL and isset | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-40335@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: richard.heyes@heyes-computing.net
> [mailto:richard.heyes@heyes-computing.net]
> Sent: Thursday, December 07, 2000 09:22
> To: php-dev@lists.php.net
> Subject: [PHP-DEV] PHP 4.0 Bug #8139 Updated: NULL and isset
>
>
> ID: 8139
> User Update by: richard.heyes@heyes-computing.net
> Old-Status: Feedback
> Status: Open
> Bug Type: Scripting Engine problem
> Description: NULL and isset
>
> No idea. Though I do know of people who use that method to
> set variables, so their answer would be a resounding no. :)
Surely if passing an unset variable by reference doesn't work as the first
guy indicated, and if the user were trying to set a mysql handle as in your
case, they would want to be warned if it didn't work (likely they had
mis-spelled the variable).
Personally I would like such use to immediatly set the variable and not have
the warning.
But the current described behaviour of neither working nor warning seems
without benefit.
Sam
>
> (EG:
> <?php
> function mconnect(&$link){
> $link = mysql_connect();
> }
>
> mconnect($db);
> ?>
> )
>
> Previous Comments:
> --------------------------------------------------------------
> -------------
>
> [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
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>