diff options
author | Andrey Hristov <andrey@php.net> | 2009-08-27 12:41:14 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2009-08-27 12:41:14 +0000 |
commit | 43d33e8a995d839f236bd0c36a249ec1a2044da9 (patch) | |
tree | 780463ec817ca0860246396dbe1c563be442d6b0 | |
parent | 39fd3a2b3cfc7eb85c2e4addd0c825c1603fca95 (diff) | |
download | php-git-43d33e8a995d839f236bd0c36a249ec1a2044da9.tar.gz |
Fix for bug#46614 Extended MySQLi class gives incorrect empty() result
-rw-r--r-- | NEWS | 8 | ||||
-rw-r--r-- | ext/mysqli/mysqli.c | 8 | ||||
-rw-r--r-- | ext/mysqli/tests/bug46614.phpt | 32 |
3 files changed, 42 insertions, 6 deletions
@@ -152,12 +152,14 @@ PHP NEWS - Fixed bug #47273 (Encoding bug in SoapServer->fault). (Dmitry) - Fixed bug #46682 (touch() afield returns different values on windows). (Pierre) -- Fixed bug #45905 (imagefilledrectangle() clipping error). - (markril at hotmail dot com, Pierre) -- Fixed bug #45141 (setcookie will output expires years of >4 digits). (Ilia) +- 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 #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) diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index da126faba5..3a13583b65 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -337,7 +337,6 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) zval *retval; mysqli_object *obj; mysqli_prop_handler *hnd; - zend_object_handlers *std_hnd; int ret; ret = FAILURE; @@ -363,7 +362,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) 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 @@ void mysqli_write_property(zval *object, zval *member, zval *value TSRMLS_DC) 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 @@ static int mysqli_object_has_property(zval *object, zval *member, int has_set_ex 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; } /* }}} */ diff --git a/ext/mysqli/tests/bug46614.phpt b/ext/mysqli/tests/bug46614.phpt new file mode 100644 index 0000000000..84248b1fbb --- /dev/null +++ b/ext/mysqli/tests/bug46614.phpt @@ -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) |