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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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 13:00:02 2026 UTC