php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20353 Change of isset behaviour
Submitted: 2002-11-11 03:42 UTC Modified: 2002-11-11 10:23 UTC
From: bariou at brasnah dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.0-pre2 OS: Red hat 7.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
21 - 8 = ?
Subscribe to this entry?

 
 [2002-11-11 03:42 UTC] bariou at brasnah dot 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....

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-11 03:46 UTC] 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 04:16 UTC] bariou at brasnah dot com
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
 [2002-11-11 04:20 UTC] derick@php.net
Please recompile and add the configure option --disable-mbstring. Does the problem still occur then?

Derick
 [2002-11-11 05:14 UTC] bariou at brasnah dot com
Derick

I've recompiled with --disable-mb_string. The behaviour, doesnot change.

I give you the ./configure directives from phpinfo() => 

'./configure' '--prefix=/usr/local/apache' '--with-apxs=/usr/local/apache/bin/apxs' '--with-config-file-path=/usr/local/apache/php' '--with-dom=/usr' '--enable-socket=shared' '--with-ttf' '--enable-inline-optimization' '-enable-magic-quotes' '--enable-trans-id' '--enable-bc-math' '--enable-memory-limit' '--enable-wddx' '--enable-sysvshm=shared' '--with-iconv=/usr/local' '--with-png-dir=/usr' '--with-jpeg-dir=/usr' '--with-tiff-dir=/usr' '--with-freetype-dir=/usr' '--with-zlib-dir=/usr' '--with-gd=/usr' '--enable-gd-native-ttf' '--with-mysql=/usr/local/mysql' '--enable-ftp' '--with-pdflib=/usr/local' '--with-xpm-dir=/usr/X11R6' '--enable-xslt' '--with-xslt-sablot=/usr/local' '--with-expat-dir=/usr' '--with-mnogosearch=/usr/local' '--with-mcrypt=/usr/local' '--with-zlib=/usr' '--with-xmlrpc' '--enable-libgcc' '--with-java=/usr/java/j2sdk1.4.1' '--with-tsrm-pth' '--disable-mbstring'

I solve the problem, on my side, through a dirty way (I check the presence of the varaible in the query string with an ereg :-( ). I think we must have the same behaviour...so it will be necessary to fix that. Feel free top ask me some other trials  

Marcel
 [2002-11-11 10:06 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


 [2002-11-11 10:23 UTC] bariou at brasnah dot com
I don't understand, if this problem is not related to PHP I must have the same behaviour for different release . The behaviour is different for the 4.2.2 release and the 4.3.0 release, PHP doesn't process in the same way data from the GET method. 

Marcel
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 11:01:24 2023 UTC