cvs: php-src(PHP_5_3) / NEWS /ext/mysqli mysqli.c mysqli_prop.c /ext/mysqli/tests mysqli_fetch_lengths_oo.phpt mysqli_result_references.phpt

From: Date: Mon, 12 Jan 2009 12:56:02 +0000
Subject: cvs: php-src(PHP_5_3) / NEWS /ext/mysqli mysqli.c mysqli_prop.c /ext/mysqli/tests mysqli_fetch_lengths_oo.phpt mysqli_result_references.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-55551@lists.php.net to get a copy of this message
johannes Mon Jan 12 12:56:02 2009 UTC Modified files: (Branch: PHP_5_3) /php-src NEWS /php-src/ext/mysqli mysqli.c mysqli_prop.c /php-src/ext/mysqli/tests mysqli_fetch_lengths_oo.phpt mysqli_result_references.phpt Log: MFH Fix #45940 MySQLI OO does not populate connect_error property on failed connect http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.443&r2=1.2027.2.547.2.965.2.444&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.965.2.443 php-src/NEWS:1.2027.2.547.2.965.2.444 --- php-src/NEWS:1.2027.2.547.2.965.2.443 Sun Jan 11 23:43:45 2009 +++ php-src/NEWS Mon Jan 12 12:56:01 2009 @@ -51,6 +51,8 @@ (Scott) - Fixed bug #45989 (json_decode() doesn't return NULL on certain invalid strings). (magicaltux, Scott) +- Fixed bug #45940 (MySQLI OO does not populate connect_error property on + failed connect). (Johannes) - Fixed bug #45820 (Allow empty keys in ArrayObject). (Etienne) - Fixed bug #45791 (json_decode() doesn't convert 0e0 to a double). (Scott) http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.17.2.36&r2=1.72.2.16.2.17.2.37&diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.36 php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.37 --- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.36 Wed Jan 7 16:32:08 2009 +++ php-src/ext/mysqli/mysqli.c Mon Jan 12 12:56:01 2009 @@ -17,7 +17,7 @@ | Ulf Wendel <uw@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli.c,v 1.72.2.16.2.17.2.36 2009/01/07 16:32:08 johannes Exp $ + $Id: mysqli.c,v 1.72.2.16.2.17.2.37 2009/01/12 12:56:01 johannes Exp $ */ #ifdef HAVE_CONFIG_H @@ -355,14 +355,6 @@ } if (ret == SUCCESS) { - if (strcmp(obj->zo.ce->name, "mysqli_driver") && - (!obj->ptr || ((MYSQLI_RESOURCE *)(obj->ptr))->status < MYSQLI_STATUS_INITIALIZED)) - { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't fetch %s", obj->zo.ce->name ); - retval = EG(uninitialized_zval_ptr); - return(retval); - } - ret = hnd->read_func(obj, &retval TSRMLS_CC); if (ret == SUCCESS) { /* ensure we're creating a temporary variable */ http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli_prop.c?r1=1.23.2.5.2.2.2.10&r2=1.23.2.5.2.2.2.11&diff_format=u Index: php-src/ext/mysqli/mysqli_prop.c diff -u php-src/ext/mysqli/mysqli_prop.c:1.23.2.5.2.2.2.10 php-src/ext/mysqli/mysqli_prop.c:1.23.2.5.2.2.2.11 --- php-src/ext/mysqli/mysqli_prop.c:1.23.2.5.2.2.2.10 Wed Dec 31 11:15:39 2008 +++ php-src/ext/mysqli/mysqli_prop.c Mon Jan 12 12:56:01 2009 @@ -15,7 +15,7 @@ | Author: Georg Richter <georg@php.net> | +----------------------------------------------------------------------+ - $Id: mysqli_prop.c,v 1.23.2.5.2.2.2.10 2008/12/31 11:15:39 sebastian Exp $ + $Id: mysqli_prop.c,v 1.23.2.5.2.2.2.11 2009/01/12 12:56:01 johannes Exp $ */ #ifdef HAVE_CONFIG_H @@ -30,7 +30,7 @@ #include "php_mysqli_structs.h" #define CHECK_STATUS(value) \ - if (((MYSQLI_RESOURCE *)obj->ptr)->status < value ) { \ + if (!obj->ptr || ((MYSQLI_RESOURCE *)obj->ptr)->status < value ) { \ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Property access is not allowed yet"); \ ZVAL_NULL(*retval); \ return SUCCESS; \ @@ -134,7 +134,6 @@ static int link_connect_errno_read(mysqli_object *obj, zval **retval TSRMLS_DC) { MAKE_STD_ZVAL(*retval); - CHECK_STATUS(MYSQLI_STATUS_INITIALIZED); ZVAL_LONG(*retval, (long)MyG(error_no)); return SUCCESS; } @@ -144,8 +143,11 @@ static int link_connect_error_read(mysqli_object *obj, zval **retval TSRMLS_DC) { MAKE_STD_ZVAL(*retval); - CHECK_STATUS(MYSQLI_STATUS_INITIALIZED); - ZVAL_STRING(*retval, MyG(error_msg), 1); + if (MyG(error_msg)) { + ZVAL_STRING(*retval, MyG(error_msg), 1); + } else { + ZVAL_NULL(*retval); + } return SUCCESS; } /* }}} */ @@ -158,6 +160,8 @@ MAKE_STD_ZVAL(*retval); + CHECK_STATUS(MYSQLI_STATUS_INITIALIZED); + mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; if (!mysql) { http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt?r1=1.2.2.2&r2=1.2.2.3&diff_format=u Index: php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt diff -u php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.2.2.2 php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.2.2.3 --- php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt:1.2.2.2 Wed Oct 10 10:14:38 2007 +++ php-src/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt Mon Jan 12 12:56:01 2009 @@ -38,6 +38,6 @@ } NULL -Warning: main(): Couldn't fetch mysqli_result in %s on line %d +Warning: main(): Property access is not allowed yet in %s on line %d NULL -done! \ No newline at end of file +done! http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_result_references.phpt?r1=1.2.2.3&r2=1.2.2.4&diff_format=u Index: php-src/ext/mysqli/tests/mysqli_result_references.phpt diff -u php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.2.2.3 php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.2.2.4 --- php-src/ext/mysqli/tests/mysqli_result_references.phpt:1.2.2.3 Tue Mar 18 16:57:31 2008 +++ php-src/ext/mysqli/tests/mysqli_result_references.phpt Mon Jan 12 12:56:01 2009 @@ -125,7 +125,17 @@ &long(4) refcount(2) } [6]=> - &object(mysqli_result)#2 (0) refcount(2){ + &object(mysqli_result)#2 (5) refcount(2){ + ["current_field"]=> + NULL refcount(1) + ["field_count"]=> + NULL refcount(1) + ["lengths"]=> + NULL refcount(1) + ["num_rows"]=> + NULL refcount(1) + ["type"]=> + NULL refcount(1) } } array(1) refcount(2){

« previous php.cvs (#55551) next »