|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34182 empty function with SPL
Submitted: 2005-08-18 10:21 UTC Modified: 2005-08-26 01:00 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: luke at qcm dot cz Assigned:
Status: No Feedback Package: SPL related
PHP Version: 5.0.4 OS: irelevant (tested on 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.
Block user comment
Status: Assign to:
Bug Type:
From: luke at qcm dot cz
New email:
PHP Version: OS:


 [2005-08-18 10:21 UTC] luke at qcm dot cz
caling empty function with SPL object attribute (arrayaccess) as parameter return always false (is not empty).

Reproduce code:
class a implements ArrayAccess {

  private $vars;

  public function offsetExists($offset) {
      return (isset($this->vars[$offset]));
  } // offsetExists

  public function offsetGet($offset) {
        return $this->vars[$offset];
    } // offsetGet

  public function offsetSet($offset, $value) {
        $this->vars[$offset] = $value;
    } // offsetSet

  public function offsetUnset($offset) {
        if ($this->offsetExists($offset)) {
        } // if
    } // offsetUnset

$x = new a();
$x['key'] = '';

$y = $x['key'];

Expected result:
string(0) "" bool(true) string(0) "" bool(true)

Actual result:
string(0) "" bool(false) string(0) "" bool(true)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-08-18 10:41 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-08-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-04-30 16:20 UTC] robert_hennig at web dot de
The bug is still there ... PHP 5.2.6 on Linux.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 08 01:05:45 2022 UTC