Bug #69476 [Com]: is_null() must not throw warnings

From: Date: Fri, 17 Apr 2015 15:49:18 +0000
Subject: Bug #69476 [Com]: is_null() must not throw warnings
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192154@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69476&edit=1 ID: 69476 Comment by: spam2 at rhsoft dot net Reported by: spam2 at rhsoft dot net Summary: is_null() must not throw warnings Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: bullshit - isset() don't work when a variable is defined and contains NULL, you should read your own documentation [harry@srv-rhsoft:/mnt/data/downloads]$ php test.php [harry@srv-rhsoft:/mnt/data/downloads]$ cat test.php <?php $x = NULL; if(isset($x)) { echo "defined\n"; } ?> Previous Comments: ------------------------------------------------------------------------ [2015-04-17 15:45:45] chx@php.net You want isset() and this has nothing to do with the specification. ------------------------------------------------------------------------ [2015-04-17 15:40:49] spam2 at rhsoft dot net Description: ------------ since isset() returns false in case a variable contains NULL (which is a major design error) is_null() MUST not throw a warning in case of a undefined variable Test script: --------------- <?php if(isset($nicht_definiert) || is_null($nicht_definiert)) { echo "defined\n"; } ?> Expected result: ---------------- no warning or a sane isset() behavior with sanity in mind how the hell do you test if a variable is defined with the isset() behavior saying no if the value is NULL Actual result: -------------- Notice: Undefined variable: nicht_definiert in /mnt/data/downloads/test.php on line 2 defined ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69476&edit=1

« previous php.bugs (#192154) next »