php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69064 extract() and null value
Submitted: 2015-02-17 09:15 UTC Modified: 2015-02-17 09:54 UTC
From: mruz at poczta dot onet dot pl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.6.5 OS: openSUSE Tumbleweed
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mruz at poczta dot onet dot pl
New email:
PHP Version: OS:

 

 [2015-02-17 09:15 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-17 09:54 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2015-02-17 09:54 UTC] requinix@php.net
isset() also returns true if the variable exists but has a value of null.
http://3v4l.org/JtmZS
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 11:00:02 2026 UTC