Bug #69064 [Opn->Nab]: extract() and null value
| From: | requinix@php.net | Date: | Tue, 17 Feb 2015 09:54:28 +0000 |
| Subject: | Bug #69064 [Opn->Nab]: extract() and null value | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190742@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69064&edit=1
ID: 69064
Updated by: requinix@php.net
Reported by: mruz at poczta dot onet dot pl
Summary: extract() and null value
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: openSUSE Tumbleweed
PHP Version: 5.6.5
Block user comment: N
Private report: N
New Comment:
isset() also returns true if the variable exists but has a value of null.
http://3v4l.org/JtmZS
Previous Comments:
------------------------------------------------------------------------
[2015-02-17 09:15:56] mruz at poczta dot onet dot pl
Description:
------------
If the array key has null value it isn't extracted to variable. Is it correct behaviour?
Test script:
---------------
<?php
$arr = [
'username' => 'mruz',
'email' => null,
'age' => 0,
'website' => false
];
extract($arr);
var_dump(isset($username), isset($email), isset($age), isset($website));
Expected result:
----------------
bool(true) bool(true) bool(true) bool(true)
Actual result:
--------------
bool(true) bool(false) bool(true) bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69064&edit=1