#46614 [Asn->Csd]: Extended MySQLi class gives incorrect empty() result (works in PHP_5_2 !)
| From: | andrey@php.net | Date: | Thu, 27 Aug 2009 12:42:07 +0000 |
| Subject: | #46614 [Asn->Csd]: Extended MySQLi class gives incorrect empty() result (works in PHP_5_2 !) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-141619@lists.php.net to get a copy of this message | ||
ID: 46614
Updated by: andrey@php.net
Reported By: sander dot vink at procurios dot nl
-Status: Assigned
+Status: Closed
Bug Type: MySQLi related
Operating System: *
PHP Version: 5.3CVS-2008-11-19 (snap)
Assigned To: mysql
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
The fix will be in 5.3.1
Previous Comments:
------------------------------------------------------------------------
[2009-08-27 12:41:14] svn@php.net
Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=287806
Log: Fix for bug#46614 Extended MySQLi class gives incorrect empty()
result
------------------------------------------------------------------------
[2008-11-21 13:05:31] jani@php.net
Ah, I tested with PHP 5.2CVS and it works as expected. So this is
PHP_5_3 (and propably HEAD) issue only.
------------------------------------------------------------------------
[2008-11-20 08:14:13] sander dot vink at procurios dot nl
Yes, exactly, it is not empty. However, I return the result of empty()
( not !empty() ) which should be false, since the array actually
contains data.
------------------------------------------------------------------------
[2008-11-19 23:12:58] jani@php.net
You set $this->fooData[]to contain 'Bar' -> it's not empty -> returns
true..what's the bug..?
------------------------------------------------------------------------
[2008-11-19 13:25:11] sander dot vink at procurios dot nl
Description:
------------
When an empty() call is done within a class that extends the MySQLi
class, an incorrect result is provided.
Reproduce code:
---------------
class Foo extends MySQLi
{
protected $fooData = array();
public function isEmpty()
{
$this->fooData[] = 'Bar';
return empty($this->fooData);
}
}
$Foo = new Foo('localhost', 'root', '', 'test');
$isEmpty = $Foo->isEmpty();
var_dump($isEmpty);
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46614&edit=1