#20353 [Fbk->Opn]: Change of isset behaviour
ID: 20353
User updated by: bariou@brasnah.com
Reported By: bariou@brasnah.com
-Status: Feedback
+Status: Open
Bug Type: Strings related
Operating System: Red hat 7.2
PHP Version: 4.3.0-pre2
New Comment:
You are right,but there is a change. I was not specific enough, in
fact I send a variable through the get method
http://somewhere/test_isset.php?bibi=&
The test_isset.php file is :
<?php
$namevar="bibi";
if(isset($$namevar)){
echo "it comes here even if the string is empty <BR>";
}else{
echo "it comes here NAMEVAR is not set or is empty <BR>";
}
if(isset($name)){
echo "it comes here if set even if the string is empty <BR>";
}else{
echo "it comes here NAME is not set <BR>";
}
?>
With the previous http request :
For 4.3.0-pre2 bibi is never set
For 4.2.2 bibi is not set only when I remove = from the get URL, it
seems logic
Idea ? Thanks
Previous Comments:
------------------------------------------------------------------------
[2002-11-11 03:46:53] derick@php.net
I can't reproduce this, works fine for me:
[derick@kossu derick]$ php
<?php
$foo = "";
if (isset($foo)) {
echo "IN HERE!\n";
}
?>
IN HERE!
[derick@kossu derick]$ php -v
PHP 4.3.0-pre2 (cli)
Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies
with eXtended Debugger (xdebug) v1.1.0dev, Copyright (c) 2002 JDI
Media Solutions, by Derick Rethans
Please post a full reproducing script that we can copy & paste, but
keep it as small as possible.
Derick
------------------------------------------------------------------------
[2002-11-11 03:42:11] bariou@brasnah.com
On 4.2.2 I've
if(isset($namevar)){
//some statements
// It comes here if $namevar is set, even if $namevar="";
}
On 4.3.0-pre2 I've
if(isset($namevar)){
//some statements
// It doesn't come if $namevar="";
}
You can't change that to much legacy....
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20353&edit=1
Thread (7 messages)