From: igordonin at gmail dot com
Operating system: Windows XP SP2
PHP version: 5.2.5
PHP Bug Type: Scripting Engine problem
Bug description: isset detects an array item that var_dump does not.
Description:
------------
Development Environment is PHP 5.2.5, Apache 2.2.
When requesting PHP to unset an array item, there's a fatal error:
Fatal error: Cannot unset string offsets in C:\[hidden]\index.php on line
147
When I var_dump the array variable, the array item is not show as part of
that array, but the unset array item command is inside a if
(isset($variable["ArrayName"])) { ... which means that the item has to
exist in order for the unset to occur.
-----
On my production enviroment, though, I'm running PHP Version 4.3.9, with
Apache Handler 2.0.52(Oracle) | API Version 20020903, and it does not cause
a Fatal Error, but the error is still there. Here's the URL:
http://helpdesk.mozart.com.br/public/index.php
-> Try to connect with anything. It matters not, I think.
If this is not a bug, I do apologize. It's just that I've checked this
code so many times and I can't find anything wrong ...
Thanks in advance.
Reproduce code:
---------------
# 1. Execute Query
$Query["Try_Login"] = Query_Repository("Try_Login", 0, 2, 0);
echo "<br><br> This is the var_dump for array \$Query: <br>";
var_dump($Query);
echo "<br><br>";
if (isset( $Query["Try_Login"]["Error"] )) { echo
"<br><br>\$Query[\"Try_Login\"][\"Error\"] is set as: \"" .
$Query["Try_Login"]["Error"] . "\".<br><br>"; }
die();
Here are the URLs for the functions that you might need to take a look at.
I saved them as txt so you may check them out.
Query_Repository:
http://helpdesk.mozart.com.br/public/query_repository.txt
Request_Value:
http://helpdesk.mozart.com.br/public/request_value.txt
validate_input:
http://helpdesk.mozart.com.br/public/validate_input.txt
Expected result:
----------------
$Query["Try_Login"] was supposed to be set only as string, either with
"conn_err" or "conn_ok". That's all var_dump really shows, and that's what
it's supposed to be ...
Actual result:
--------------
... but it was also supposed to not have an ["Error"] array Item. It's not
shown while using var_dump, but "isset" returns true, and it's value is set
to string "c". Still, I cannot unset it for it may produce a fatal error.
Fatal error: Cannot unset string offsets in C:\[hidden]\index.php on line
147
--
Edit bug report at http://bugs.php.net/?id=44863&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44863&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44863&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44863&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44863&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44863&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44863&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44863&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44863&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44863&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44863&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44863&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44863&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44863&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44863&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44863&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44863&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44863&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44863&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44863&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44863&r=mysqlcfg