Bug #67067 [Opn->Dup]: isset() and empty() on NULL value of the ArrayObject child class

From: Date: Thu, 08 May 2014 17:11:07 +0000
Subject: Bug #67067 [Opn->Dup]: isset() and empty() on NULL value of the ArrayObject child class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185722@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67067&edit=1

 ID:                 67067
 Updated by:         levim@php.net
 Reported by:        dmitriy dot trt at gmail dot com
 Summary:            isset() and empty() on NULL value of the ArrayObject
                     child class
-Status:             Open
+Status:             Duplicate
 Type:               Bug
 Package:            *General Issues
 Operating System:   Windows 7 x86, Linux
 PHP Version:        5.4.27
 Block user comment: N
 Private report:     N

 New Comment:

Closing as a duplicate of bug 66834.


Previous Comments:
------------------------------------------------------------------------
[2014-04-13 19:21:38] 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)
  }
}


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=67067&edit=1


Thread (2 messages)

« previous php.bugs (#185722) next »