ID: 44863
Updated by: [EMAIL PROTECTED]
Reported By: igordonin at gmail dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Windows XP SP2
PHP Version: 5.2.5
New Comment:
for the last time, you've $Query['Try_Login'] = "conn_err"; and you're
doing an isset($Query['Try_Login']['Error']);
So, $Query['Try_Login'] is a string.
This is equivalent to $mystring = "conn_err"; and
isset($mystring['Error']) which is equivalent to isset($mystring[0]);
You're wrongly using isset() here, You probably want to check whether
'Error' is a defined index of $Query, so do isset($Query['Error'])..
instead of isset($Query['Try_Login']['Error']).
But really bugs.php.net is not a place for that kind of support, you
should check out php.net/support and find a medium that suits you
better.
Regards.
Previous Comments:
------------------------------------------------------------------------
[2008-04-29 19:13:18] igordonin at gmail dot com
Hey, I don't mean to be annoying, hope didn't get there yet, but check
this out:
Query_Repository returns string "conn_err", so it's the same as:
$Query["Try_Login"] = "conn_err";
var_dump( $Query ) results in:
array(1) { ["Try_Login"]=> string(8) "conn_err" }
There's no suck key as ["Error"] at all ...
So what you mean is that isset will recognize
$Query["Try_Login"]["Error"] as $Query["Try_Login"][0] because of the
string offset and then return true?
You may be right, that may be in fact the current behavior, but I don't
see how that can be the best behavior at all!
I'm no expert though. So thank you very much for taking the time to
reply. I do appreciate it.
------------------------------------------------------------------------
[2008-04-29 19:03:11] [EMAIL PROTECTED]
Yes this is expected:
non-numeric indexes are interpreted as 0 for string offsets.
so isset($string["foo"]) is equivalent to isset($string[0]) which
checks whether the string offset 0 exists, and it does, your string is
not empty.
------------------------------------------------------------------------
[2008-04-29 18:56:29] igordonin at gmail dot com
You're right!
But is this expected to return true?
if (isset($Query["Try_Login"]["Error")) {
unset($Query["Try_Login"]["Error"]);
}
'Cause that's when I'm trying to unset $Query["Try_Login"]["Error"] ...
------------------------------------------------------------------------
[2008-04-29 18:51:57] [EMAIL PROTECTED]
Look: $Query is an array that contains a string at the index
"Try_Login". So $Query["Try_Login"] is a string.
You're unsetting $Query["Try_Login"]["Error"] so yes, you're trying to
unset an offset of a string.
------------------------------------------------------------------------
[2008-04-29 18:43:26] igordonin at gmail dot com
You're wrong, var_dump says:
array(1) { ["Try_Login"]=> string(8) "conn_err" }
It's so an array!
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/44863
--
Edit this bug report at http://bugs.php.net/?id=44863&edit=1