svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqli/mysqli.c branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt
trunk/ext/mysqli/mysqli.c trunk/ext/mysqli/tests/bug46614.phpt
| From: | Andrey Hristov | Date: | Thu, 27 Aug 2009 12:41:14 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/mysqli/mysqli.c branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt trunk/ext/mysqli/mysqli.c trunk/ext/mysqli/tests/bug46614.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-60251@lists.php.net to get a copy of this message | ||
andrey Thu, 27 Aug 2009 12:41:14 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=287806
Log:
Fix for bug#46614 Extended MySQLi class gives incorrect empty() result
Bug: http://bugs.php.net/46614 (Assigned) Extended MySQLi
class gives incorrect empty() result (works in PHP_5_2 !)
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c
A php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt
U php/php-src/trunk/ext/mysqli/mysqli.c
A php/php-src/trunk/ext/mysqli/tests/bug46614.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2009-08-27 12:34:57 UTC (rev 287805)
+++ php/php-src/branches/PHP_5_3/NEWS 2009-08-27 12:41:14 UTC (rev 287806)
@@ -152,12 +152,14 @@
- Fixed bug #47273 (Encoding bug in SoapServer->fault). (Dmitry)
- Fixed bug #46682 (touch() afield returns different values on windows).
(Pierre)
+- Fiexs bug #46614 (Extended MySQLi class gives incorrect empty() result).
+ (Andrey)
+- Fixed bug #46020 (with Sun Java System Web Server 7.0 on HPUX, #define HPUX).
+ (Uwe Schindler)
- Fixed bug #45905 (imagefilledrectangle() clipping error).
(markril at hotmail dot com, Pierre)
+- Fixed bug #45554 (Inconsistent behavior of the u format char). (Derick)
- Fixed bug #45141 (setcookie will output expires years of >4 digits). (Ilia)
-- Fixed bug #46020 (with Sun Java System Web Server 7.0 on HPUX, #define HPUX).
- (Uwe Schindler)
-- Fixed bug #45554 (Inconsistent behavior of the u format char). (Derick)
- Fixed bug #44683 (popen crashes when an invalid mode is passed). (Pierre)
- Fixed bug #43510 (stream_get_meta_data() does not return same mode as used
in fopen). (Jani)
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c 2009-08-27 12:34:57 UTC (rev 287805)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c 2009-08-27 12:41:14 UTC (rev 287806)
@@ -337,7 +337,6 @@
zval *retval;
mysqli_object *obj;
mysqli_prop_handler *hnd;
- zend_object_handlers *std_hnd;
int ret;
ret = FAILURE;
@@ -363,7 +362,7 @@
retval = EG(uninitialized_zval_ptr);
}
} else {
- std_hnd = zend_get_std_object_handlers();
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
retval = std_hnd->read_property(object, member, type TSRMLS_CC);
}
@@ -403,7 +402,7 @@
zval_ptr_dtor(&value);
}
} else {
- std_hnd = zend_get_std_object_handlers();
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
std_hnd->write_property(object, member, value TSRMLS_CC);
}
@@ -460,6 +459,9 @@
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for has_set_exists");
}
+ } else {
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
+ ret = std_hnd->has_property(object, member, has_set_exists TSRMLS_CC);
}
return ret;
} /* }}} */
Added: php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/bug46614.phpt 2009-08-27 12:41:14 UTC (rev 287806)
@@ -0,0 +1,32 @@
+--TEST--
+Bug #46614 (Extended MySQLi class gives incorrect empty() result)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+if (!defined("MYSQLI_ASYNC")) {
+ die("skip mysqlnd only");
+}
+?>
+--FILE--
+<?php
+class MySQL_Ext extends mysqli{
+ protected $fooData = array();
+
+ public function isEmpty()
+ {
+ $this->extData[] = 'Bar';
+ return empty($this->extData);
+ }
+}
+
+
+
+ include ("connect.inc");
+ $MySQL_Ext = new MySQL_Ext($host, $user, $passwd, $db);
+
+ $isEmpty = $MySQL_Ext->isEmpty();
+ var_dump($isEmpty);
+?>
+--EXPECT--
+bool(false)
Modified: php/php-src/trunk/ext/mysqli/mysqli.c
===================================================================
--- php/php-src/trunk/ext/mysqli/mysqli.c 2009-08-27 12:34:57 UTC (rev 287805)
+++ php/php-src/trunk/ext/mysqli/mysqli.c 2009-08-27 12:41:14 UTC (rev 287806)
@@ -330,7 +330,6 @@
zval *retval;
mysqli_object *obj;
mysqli_prop_handler *hnd;
- zend_object_handlers *std_hnd;
int ret;
ret = FAILURE;
@@ -356,7 +355,7 @@
retval = EG(uninitialized_zval_ptr);
}
} else {
- std_hnd = zend_get_std_object_handlers();
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
retval = std_hnd->read_property(object, member, type TSRMLS_CC);
}
@@ -373,7 +372,6 @@
zval tmp_member;
mysqli_object *obj;
mysqli_prop_handler *hnd;
- zend_object_handlers *std_hnd;
int ret;
if (member->type != IS_STRING) {
@@ -396,7 +394,7 @@
zval_ptr_dtor(&value);
}
} else {
- std_hnd = zend_get_std_object_handlers();
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
std_hnd->write_property(object, member, value TSRMLS_CC);
}
@@ -461,6 +459,9 @@
default:
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value for has_set_exists");
}
+ } else {
+ zend_object_handlers * std_hnd = zend_get_std_object_handlers();
+ ret = std_hnd->has_property(object, member, has_set_exists TSRMLS_CC);
}
if (member == &tmp_member) {
zval_dtor(member);
Added: php/php-src/trunk/ext/mysqli/tests/bug46614.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/bug46614.phpt (rev 0)
+++ php/php-src/trunk/ext/mysqli/tests/bug46614.phpt 2009-08-27 12:41:14 UTC (rev 287806)
@@ -0,0 +1,32 @@
+--TEST--
+Bug #46614 (Extended MySQLi class gives incorrect empty() result)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+if (!defined("MYSQLI_ASYNC")) {
+ die("skip mysqlnd only");
+}
+?>
+--FILE--
+<?php
+class MySQL_Ext extends mysqli{
+ protected $fooData = array();
+
+ public function isEmpty()
+ {
+ $this->extData[] = 'Bar';
+ return empty($this->extData);
+ }
+}
+
+
+
+ include ("connect.inc");
+ $MySQL_Ext = new MySQL_Ext($host, $user, $passwd, $db);
+
+ $isEmpty = $MySQL_Ext->isEmpty();
+ var_dump($isEmpty);
+?>
+--EXPECT--
+bool(false)