php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67067 isset() and empty() on NULL value of the ArrayObject child class
Submitted: 2014-04-13 19:21 UTC Modified: 2014-05-08 17:11 UTC
From: dmitriy dot trt at gmail dot com Assigned:
Status: Duplicate Package: *General Issues
PHP Version: 5.4.27 OS: Windows 7 x86, Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dmitriy dot trt at gmail dot com
New email:
PHP Version: OS:

 

 [2014-04-13 19:21 UTC] dmitriy dot trt at gmail dot com
Description:
------------
ArrayObject itself and child classes work fine until you override offsetExists() method, even with a method returning parent's results. Both isset() and empty() return incorrect results on NULL value set to the pseudo-array.

Reproducible on PHP 5.4.27, Windows 7 x86.

Test script:
---------------
http://pastebin.com/geNadPSA

Expected result:
----------------
array(2) {
  ["ArrayObject"]=>
  array(2) {
    ["empty"]=>
    bool(true)
    ["isset"]=>
    bool(false)
  }
  ["ArrayObjectOverride"]=>
  array(2) {
    ["empty"]=>
    bool(true)
    ["isset"]=>
    bool(false)
  }
}

Actual result:
--------------
array(2) {
  ["ArrayObject"]=>
  array(2) {
    ["empty"]=>
    bool(true)
    ["isset"]=>
    bool(false)
  }
  ["ArrayObjectOverride"]=>
  array(2) {
    ["empty"]=>
    bool(false)
    ["isset"]=>
    bool(true)
  }
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-05-08 17:11 UTC] levim@php.net
-Status: Open +Status: Duplicate
 [2014-05-08 17:11 UTC] levim@php.net
Closing as a duplicate of bug 66834.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 13:01:30 2024 UTC