ID:               34182
 Comment by:       robert_hennig at web dot de
 Reported By:      luke at qcm dot cz
 Status:           No Feedback
 Bug Type:         SPL related
 Operating System: irelevant (tested on linux)
 PHP Version:      5.0.4
 New Comment:

The bug is still there ... PHP 5.2.6 on Linux.


Previous Comments:
------------------------------------------------------------------------

[2005-08-26 01:00:04] 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".

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

[2005-08-18 10:41:40] tony2...@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



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

[2005-08-18 10:21:25] luke at qcm dot cz

Description:
------------
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)) {
            unset($this->vars[$offset]);
        } // if
    } // offsetUnset
}

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

$y = $x['key'];
var_dump($y);
var_dump(empty($y));


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

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


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


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

Reply via email to