|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-18 10:41 UTC] tony2001@php.net
[2005-08-26 01:00 UTC] php-bugs at lists dot php dot net
[2009-04-30 16:20 UTC] robert_hennig at web dot de
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
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)