|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15678 isset fails for 4.1.1 and CVS version
Submitted: 2002-02-22 11:03 UTC Modified: 2002-07-07 12:58 UTC
Avg. Score:4.9 ± 0.3
Reproduced:16 of 16 (100.0%)
Same Version:1 (6.2%)
Same OS:1 (6.2%)
From: alberty at neptunelabs dot de Assigned:
Status: Wont fix Package: Variables related
PHP Version: 4.0CVS-2002-02-2 OS: i686-pc-linux-gnu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-02-22 11:03 UTC] alberty at neptunelabs dot de

the declaration of a second dimension in a normal array results
a strange array content.



    [c] => boo

is this a normal behavior?

i think this ist completely wrong, because 'd' is not string position 1.

Also a normal condition like

if (isset($x['c']['y'])) echo 'yep';
else echo 'no';

results true ... but it is absolutely not true

i have test it on linux with the lastest cvs tree php version.




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-22 11:17 UTC] alberty at neptunelabs dot de
Andrey Hristov wrote:
>The answer to your question:
>  var_dump((int) 'y');


this is not the answer of the second question and also not to the first one, because

echo $c[0];
"Notice: Undefined offset: 0 in foo.php on line 2"
 [2002-02-22 11:41 UTC]
Btw, this has nothing to do with current CVS. This applies to at least 4.1.0 I tested (so there's nothing broken since current stable and CVS; if it's broken, it is for a long time)
 [2002-02-23 22:59 UTC]
It should be fixed before 4.2.0 at least.
Hopefully before 4.1.2 :)
 [2002-02-27 07:24 UTC]
not critical
 [2002-02-28 03:47 UTC]
This is critical bug in any cases.
isset() must not return FALSE when value is not set.  This is enough to be a critical bug.

This bug is not only hard to find, but also can make security hole in script. Don't you have script relys on isset() to grant access? (Well,  I don't have actually since I like everything to be explicit, but some users will have)
 [2002-02-28 04:29 UTC]
isset() must not return FALSE when value is not set.

should be

isset() must not return TRUE when value is not set.

 [2002-03-26 03:59 UTC]
Not critical. PHP can not work around *all* user errors.

 [2002-04-19 14:43 UTC] warnke at freistunden dot de

i've noticed this error to and i think it is very critical.

I think the error has to do with strings that are checked as if they were arrays.


$string = 'wef23';
if(isset($string['key'])) {
	echo 'true';
} else {
	echo 'false';

it always returns true.

Tested with:

- PHP Version 4.1.1 (Linux infong 2.2.20-hap-2 #1 Fri Dec 14 17:08:09 CET 2001 m68k recovery) [Suse Linux]
- PHP Version 4.0.6 (OpenBSD 3.0 GENERIC#2 i386)
- PHP Version 4.1.0 (Windows NT 5.1 build 2600) [Windows XP]

You can get around this bug if you add an extra check:
if(is_array($string) && isset($string['key'])) 

but i think this could easily be done in the php c souces, or not?


Lutz Warnke
 [2002-07-07 12:58 UTC]
As we said before: We can not work around all user mistakes. Changing the status to "Won't fix"
 [2002-08-01 14:51 UTC] Warnke at freistunden dot de

use the function 

(PHP version 4.0.6)


(PHP 4 >= 4.1.0)

this should solve all the problems

Lutz Warnke
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 01:01:29 2024 UTC