From: mauthi at gmx dot net Operating system: PHP version: 5.2.1 PHP Bug Type: *General Issues Bug description: isset - null - is_null
Description: ------------ In my function (see code below) i tried to return the value of an array at position "key" If the value is null, i want to return null - it works as shown in the code - but if the key is not set - my function also returns "null"! So i can't find a solution to differ "null" or "not set"! Reproduce code: --------------- $a = array(); // case 1: $a["key"] = null; // end case 1 // case 2: // end case 2 if (isset($a["key"])) { return $a["key"]; } else { if (is_null($a["key"]) return null; else return "key not set!"; } Expected result: ---------------- case 1: null case 2: "key not set!" Actual result: -------------- case 1: null case 2: null >> Undefined Index: key in XXX (in log file) -- Edit bug report at http://bugs.php.net/?id=40791&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40791&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40791&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40791&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40791&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40791&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40791&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40791&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40791&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40791&r=support Expected behavior: http://bugs.php.net/fix.php?id=40791&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40791&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40791&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40791&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40791&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40791&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40791&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40791&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40791&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40791&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40791&r=mysqlcfg