Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
2011/9/19 Johannes Schlüter johan...@schlueters.de: On Mon, 2011-09-19 at 12:25 +0200, Ferenc Kovacs wrote: Good point, are you proposing to change code and make libmysql 5.0+ a requirement? If so, several changes should be made to ext/mysql, ext/mysqli and PDO_MySQL. I think that it is your call, but yes, I think it would reasonable, and it would make our/your work much easier if we would have to support fewer major versions. While we can't change requirements in bug fix versions (5.3.x) and not sure this is a good thing to do during beta (5.4) from other POV: beta is the last time to make such changes. but as I said, it is your call. -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
Am 17.09.2011 05:12, schrieb Xinchen Hui: laruence Sat, 17 Sep 2011 03:12:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316895 Log: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) Since the catalog values always is def now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when calling mysqli_fetch_fields Ideally, you would wait for a libmysql fix, after the fix add a version change and revert. What if libmysql decides to set a value in the future? What about people who still use MySQL 4.1.0 ? Ulf -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
Hi: hmm, maybe we can revert this change after a libmysql fixed version? thanks 2011/9/19 Ulf Wendel ulf.wen...@oracle.com: Am 17.09.2011 05:12, schrieb Xinchen Hui: laruence Sat, 17 Sep 2011 03:12:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316895 Log: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) Since the catalog values always is def now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when calling mysqli_fetch_fields Ideally, you would wait for a libmysql fix, after the fix add a version change and revert. What if libmysql decides to set a value in the future? What about people who still use MySQL 4.1.0 ? Ulf -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
On Mon, Sep 19, 2011 at 10:19 AM, Ulf Wendel ulf.wen...@oracle.com wrote: Am 17.09.2011 05:12, schrieb Xinchen Hui: laruence Sat, 17 Sep 2011 03:12:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316895 Log: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) Since the catalog values always is def now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when calling mysqli_fetch_fields Ideally, you would wait for a libmysql fix, after the fix add a version change and revert. What if libmysql decides to set a value in the future? What about people who still use MySQL 4.1.0 ? uhm, 4.1 is EOLed for some time by now, why should we care about such an old version? http://www.mysql.com/support/eol-notice.html -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
Am 19.09.2011 11:57, schrieb Ferenc Kovacs: On Mon, Sep 19, 2011 at 10:19 AM, Ulf Wendelulf.wen...@oracle.com wrote: Am 17.09.2011 05:12, schrieb Xinchen Hui: laruence Sat, 17 Sep 2011 03:12:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316895 Log: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) Since the catalog values always is def now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when calling mysqli_fetch_fields Ideally, you would wait for a libmysql fix, after the fix add a version change and revert. What if libmysql decides to set a value in the future? What about people who still use MySQL 4.1.0 ? uhm, 4.1 is EOLed for some time by now, why should we care about such an old version? http://www.mysql.com/support/eol-notice.html Good point, are you proposing to change code and make libmysql 5.0+ a requirement? If so, several changes should be made to ext/mysql, ext/mysqli and PDO_MySQL. Ulf nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_4 grep -H -n -R MYSQL_VERSION_ID ext/mysqli/*.c [snip] ext/mysqli/mysqli.c:611:#if MYSQL_VERSION_ID = 4 [snip] ext/mysqli/mysqli.c:854:#if MYSQL_VERSION_ID = 4 ext/mysqli/mysqli.c:886:#if !defined(MYSQLI_USE_MYSQLND) defined(ZTS) MYSQL_VERSION_ID = 4 ext/mysqli/mysqli.c:924:#if !defined(MYSQLI_USE_MYSQLND) defined(ZTS) MYSQL_VERSION_ID = 4 nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_4 grep -H -n -R MYSQL_VERSION_ID ext/mysql/*.c ext/mysql/php_mysql.c:82:#if MYSQL_VERSION_ID 32199 || defined(MYSQL_USE_MYSQLND) ext/mysql/php_mysql.c:92:#if MYSQL_VERSION_ID = 32032 || defined(MYSQL_USE_MYSQLND) ext/mysql/php_mysql.c:96:#if MYSQL_VERSION_ID 32133 || defined(FIELD_TYPE_TINY) ext/mysql/php_mysql.c:100:#if MYSQL_VERSION_ID = 32200 ext/mysql/php_mysql.c:111:#if MYSQL_VERSION_ID 32224 ext/mysql/php_mysql.c:129:#if MYSQL_VERSION_ID = 40101 ext/mysql/php_mysql.c:247:#if MYSQL_VERSION_ID 4 ext/mysql/php_mysql.c:308:#if MYSQL_VERSION_ID 4 ext/mysql/php_mysql.c:571:#if MYSQL_VERSION_ID = 4 ext/mysql/php_mysql.c:578:#if MYSQL_VERSION_ID = 4 ext/mysql/php_mysql.c:598:#if MYSQL_VERSION_ID = 4 ext/mysql/php_mysql.c:623:#if !defined(MYSQL_USE_MYSQLND) defined(ZTS) MYSQL_VERSION_ID = 4 ext/mysql/php_mysql.c:655:#if !defined(MYSQL_USE_MYSQLND) defined(ZTS) MYSQL_VERSION_ID = 4 ext/mysql/php_mysql.c:727:#if MYSQL_VERSION_ID = 32230 ext/mysql/php_mysql.c:734: if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) { ext/mysql/php_mysql.c:737: MYSQL_VERSION_ID, mysql_get_client_version()); ext/mysql/php_mysql.c:836:#if MYSQL_VERSION_ID 32200 ext/mysql/php_mysql.c:1375:#if MYSQL_VERSION_ID 4 ext/mysql/php_mysql.c:1487:#if MYSQL_VERSION_ID 32199 nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_4 grep -H -n -R MYSQL_VERSION_ID ext/pdo_mysql/*.c ext/pdo_mysql/mysql_driver.c:330:#if MYSQL_VERSION_ID = 40100 || defined(PDO_USE_MYSQLND) ext/pdo_mysql/mysql_driver.c:342:#if MYSQL_VERSION_ID = 40100 || defined(PDO_USE_MYSQLND) ext/pdo_mysql/mysql_driver.c:356:#if MYSQL_VERSION_ID = 40100 || defined(PDO_USE_MYSQLND) ext/pdo_mysql/mysql_driver.c:481:#if MYSQL_VERSION_ID = 32230 ext/pdo_mysql/mysql_driver.c:489:#if MYSQL_VERSION_ID 32230 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
Good point, are you proposing to change code and make libmysql 5.0+ a requirement? If so, several changes should be made to ext/mysql, ext/mysqli and PDO_MySQL. I think that it is your call, but yes, I think it would reasonable, and it would make our/your work much easier if we would have to support fewer major versions. -- Ferenc Kovács @Tyr43l - http://tyrael.hu -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
On Mon, 2011-09-19 at 12:25 +0200, Ferenc Kovacs wrote: Good point, are you proposing to change code and make libmysql 5.0+ a requirement? If so, several changes should be made to ext/mysql, ext/mysqli and PDO_MySQL. I think that it is your call, but yes, I think it would reasonable, and it would make our/your work much easier if we would have to support fewer major versions. While we can't change requirements in bug fix versions (5.3.x) and not sure this is a good thing to do during beta (5.4) johannes -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
laruence Sat, 17 Sep 2011 03:12:23 + Revision: http://svn.php.net/viewvc?view=revisionrevision=316895 Log: Fix Bug #55703(PHP crash when calling mysqli_fetch_fields) Since the catalog values always is def now, see http://dev.mysql.com/doc/refman/5.0/en/c-api-data-structures.html Bug: https://bugs.php.net/55703 (Duplicate) PHP crash when calling mysqli_fetch_fields Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2011-09-17 02:52:08 UTC (rev 316894) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2011-09-17 03:12:23 UTC (rev 316895) @@ -1053,8 +1053,13 @@ add_property_string(value, orgtable, (char *) (field-org_table ? field-org_table : ), 1); add_property_string(value, def, (field-def ? field-def : ), 1); add_property_string(value, db, (field-db ? field-db : ), 1); - add_property_string(value, catalog, (field-catalog ? field-catalog : ), 1); + /* FIXME: manually set the catalog to def due to bug in +* libmysqlclient which does not initialize field-catalog +* and in addition, the catalog is always be def +*/ + add_property_string(value, catalog, def, 1); + add_property_long(value, max_length, field-max_length); add_property_long(value, length, field-length); add_property_long(value, charsetnr, field-charsetnr); Modified: php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c2011-09-17 02:52:08 UTC (rev 316894) +++ php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c2011-09-17 03:12:23 UTC (rev 316895) @@ -1057,8 +1057,13 @@ add_property_string(value, orgtable,(field-org_table ? field-org_table : ), 1); add_property_string(value, def,(field-def ? field-def : ), 1); add_property_string(value, db,(field-db ? field-db : ), 1); - add_property_string(value, catalog,(field-catalog ? field-catalog : ), 1); + /* FIXME: manually set the catalog to def due to bug in +* libmysqlclient which does not initialize field-catalog +* and in addition, the catalog is always be def +*/ + add_property_string(value, catalog, def, 1); + add_property_long(value, max_length, field-max_length); add_property_long(value, length, field-length); add_property_long(value, charsetnr, field-charsetnr); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-09-17 02:52:08 UTC (rev 316894) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-09-17 03:12:23 UTC (rev 316895) @@ -1057,8 +1057,13 @@ add_property_string(value, orgtable,(field-org_table ? field-org_table : ), 1); add_property_string(value, def,(field-def ? field-def : ), 1); add_property_string(value, db,(field-db ? field-db : ), 1); - add_property_string(value, catalog,(field-catalog ? field-catalog : ), 1); + /* FIXME: manually set the catalog to def due to bug in +* libmysqlclient which does not initialize field-catalog +* and in addition, the catalog is always be def +*/ + add_property_string(value, catalog, def, 1); + add_property_long(value, max_length, field-max_length); add_property_long(value, length, field-length); add_property_long(value, charsetnr, field-charsetnr); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
andrey Tue, 02 Aug 2011 15:30:58 + Revision: http://svn.php.net/viewvc?view=revisionrevision=314116 Log: Remove a warning by explicitly compiling out a non-used variable Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2011-08-02 15:09:40 UTC (rev 314115) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2011-08-02 15:30:58 UTC (rev 314116) @@ -2233,7 +2233,9 @@ MY_STMT *stmt; zval*mysql_stmt; longmode_in; +#if MYSQL_VERSION_ID = 50107 my_bool mode_b; +#endif ulong mode; ulong attr; void*mode_p; Modified: php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c2011-08-02 15:09:40 UTC (rev 314115) +++ php/php-src/branches/PHP_5_4/ext/mysqli/mysqli_api.c2011-08-02 15:30:58 UTC (rev 314116) @@ -2237,7 +2237,9 @@ MY_STMT *stmt; zval*mysql_stmt; longmode_in; +#if MYSQL_VERSION_ID = 50107 my_bool mode_b; +#endif ulong mode; ulong attr; void*mode_p; Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-08-02 15:09:40 UTC (rev 314115) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2011-08-02 15:30:58 UTC (rev 314116) @@ -2237,7 +2237,9 @@ MY_STMT *stmt; zval*mysql_stmt; longmode_in; +#if MYSQL_VERSION_ID = 50107 my_bool mode_b; +#endif ulong mode; ulong attr; void*mode_p; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c branches/PHP_5_3/ext/mysqli/mysqli_report.c trunk/ext/mysqli/mysqli_api.c trunk/ext/my
andrey Wed, 10 Nov 2010 13:57:09 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305244 Log: Fix bad types, because zend_parse_xxx expect signed integers for lengths, no matter how stupid this is :) Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_report.c U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_nonapi.c U php/php-src/trunk/ext/mysqli/mysqli_report.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-11-10 12:49:04 UTC (rev 305243) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-11-10 13:57:09 UTC (rev 305244) @@ -1763,7 +1763,7 @@ MY_MYSQL*mysql; MY_STMT *stmt; char*query = NULL; - unsigned intquery_len; + int query_len; zval*mysql_link; MYSQLI_RESOURCE *mysqli_resource; @@ -1847,10 +1847,10 @@ Binary-safe version of mysql_query() */ PHP_FUNCTION(mysqli_real_query) { - MY_MYSQL*mysql; - zval*mysql_link; - char*query = NULL; - unsigned intquery_len; + MY_MYSQL*mysql; + zval*mysql_link; + char*query = NULL; + int query_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os, mysql_link, mysqli_link_class_entry, query, query_len) == FAILURE) { return; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2010-11-10 12:49:04 UTC (rev 305243) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2010-11-10 13:57:09 UTC (rev 305244) @@ -62,7 +62,7 @@ MYSQLI_RESOURCE *mysqli_resource = NULL; zval*object = getThis(); char*hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL; - unsigned inthostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0; + int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0; zend_bool persistent = FALSE; longport = 0, flags = 0; uinthash_len; @@ -362,9 +362,9 @@ #if defined(MYSQLI_USE_MYSQLND) PHP_FUNCTION(mysqli_fetch_all) { - MYSQL_RES *result; - zval*mysql_result; - longmode = MYSQLND_FETCH_NUM; + MYSQL_RES *result; + zval*mysql_result; + longmode = MYSQLND_FETCH_NUM; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), O|l, mysql_result, mysqli_result_class_entry, mode) == FAILURE) { return; @@ -437,10 +437,10 @@ allows to execute multiple queries */ PHP_FUNCTION(mysqli_multi_query) { - MY_MYSQL*mysql; - zval*mysql_link; - char*query = NULL; - unsigned intquery_len; + MY_MYSQL*mysql; + zval*mysql_link; + char*query = NULL; + int query_len; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os, mysql_link, mysqli_link_class_entry, query, query_len) == FAILURE) { return; @@ -485,8 +485,8 @@ MYSQLI_RESOURCE *mysqli_resource; MYSQL_RES *result; char*query = NULL; - unsigned intquery_len; - unsigned long resultmode = MYSQLI_STORE_RESULT; + int query_len; + longresultmode = MYSQLI_STORE_RESULT; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Os|l, mysql_link, mysqli_link_class_entry, query, query_len, resultmode) == FAILURE) { return; @@ -873,10 +873,10 @@ sets client character set */ PHP_FUNCTION(mysqli_set_charset) { - MY_MYSQL*mysql; - zval*mysql_link; - char*cs_name; - int csname_len; + MY_MYSQL*mysql; + zval*mysql_link; + char
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c trunk/ext/mysqli/mysqli_api.
andrey Wed, 06 Oct 2010 11:11:02 + Revision: http://svn.php.net/viewvc?view=revisionrevision=304146 Log: Fix for Bug #52686 mysql_stmt_attr_[gs]et arg. points to incorrect type Bug: http://bugs.php.net/52686 (Assigned) mysql_stmt_attr_[gs]et arg. points to incorrect type Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-10-06 11:07:15 UTC (rev 304145) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2010-10-06 11:11:02 UTC (rev 304146) @@ -380,11 +380,11 @@ case MYSQL_TYPE_NEWDECIMAL: #endif { -#if MYSQL_VERSION_ID 50099 +#if MYSQL_VERSION_ID = 50107 /* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */ my_bool tmp; #else -ulong tmp = 0; +uint tmp = 0; #endif stmt-result.buf[ofs].type = IS_STRING; /* @@ -2231,8 +2231,10 @@ MY_STMT *stmt; zval *mysql_stmt; long mode_in; + my_bool mode_b; ulong mode; ulong attr; + void *mode_p; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Oll, mysql_stmt, mysqli_stmt_class_entry, attr, mode_in) == FAILURE) { return; @@ -2244,11 +2246,22 @@ RETURN_FALSE; } - mode = mode_in; + switch (attr) { +#if MYSQL_VERSION_ID = 50107 + case STMT_ATTR_UPDATE_MAX_LENGTH: + mode_b = (my_bool) mode_in; + mode_p = mode_b; + break; +#endif + default: + mode = mode_in; + mode_p = mode; + break; + } #if !defined(MYSQLI_USE_MYSQLND) - if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (mysql_stmt_attr_set(stmt-stmt, attr, mode_p)) { #else - if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, mode_p)) { #endif RETURN_FALSE; } @@ -2262,11 +2275,7 @@ { MY_STMT *stmt; zval *mysql_stmt; -#if !defined(MYSQLI_USE_MYSQLND) MYSQL_VERSION_ID 50099 - my_bool value; -#else ulong value = 0; -#endif ulong attr; int rc; @@ -2278,6 +2287,11 @@ if ((rc = mysql_stmt_attr_get(stmt-stmt, attr, value))) { RETURN_FALSE; } + +#if MYSQL_VERSION_ID = 50107 + if (attr == STMT_ATTR_UPDATE_MAX_LENGTH) + value = *((my_bool *)value); +#endif RETURN_LONG((long)value); } /* }}} */ @@ -2423,7 +2437,11 @@ stmt-stmt-fields[i].type == MYSQL_TYPE_LONG_BLOB || stmt-stmt-fields[i].type == MYSQL_TYPE_GEOMETRY)) { +#if MYSQL_VERSION_ID = 50107 my_bool tmp=1; +#else +uint tmp=1; +#endif mysql_stmt_attr_set(stmt-stmt, STMT_ATTR_UPDATE_MAX_LENGTH, tmp); break; } Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-10-06 11:07:15 UTC (rev 304145) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-10-06 11:11:02 UTC (rev 304146) @@ -92,6 +92,9 @@ $stmt = mysqli_stmt_init($link); $stmt-prepare(SELECT label FROM test); $stmt-attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 1); + $res = $stmt-attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if ($res !== 1) + printf([007.1] max_length should be 1, got %s\n, $res); $stmt-execute(); $stmt-store_result(); $res = $stmt-result_metadata(); @@ -109,6 +112,9 @@ $stmt = mysqli_stmt_init($link); $stmt-prepare(SELECT label FROM test); $stmt-attr_set(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH, 0); + $res = $stmt-attr_get(MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH); + if ($res !== 0) + printf([008.1] max_length should be 0, got %s\n, $res); $stmt-execute(); $stmt-store_result(); $res = $stmt-result_metadata(); Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2010-10-06 11:07:15 UTC (rev 304145) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2010-10-06 11:11:02 UTC (rev 304146) @@ -1827,39 +1827,42 @@ const void * const value TSRMLS_DC) { MYSQLND_STMT_DATA * stmt = s? s-data:NULL; - unsigned long val = *(unsigned long *) value; DBG_ENTER(mysqlnd_stmt::attr_set); if (!stmt) { DBG_RETURN(FAIL); } - DBG_INF_FMT(stmt=%lu attr_type=%u value=%lu, stmt-stmt_id, attr_type, val); + DBG_INF_FMT(stmt=%lu attr_type=%u, stmt-stmt_id, attr_type); switch (attr_type) { - case STMT_ATTR_UPDATE_MAX_LENGTH: + case STMT_ATTR_UPDATE_MAX_LENGTH:{ + zend_uchar bval = *(zend_uchar *) value; /* XXX :
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/mysqli_prop.c trunk/ext/mysqli/mysqli.c trunk/ext/mysqli/mysqli_prop.c trunk/ext/mysqli/mysqli_result_
kalleTue, 05 Oct 2010 09:40:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=304070 Log: Fixed compiler warnings in mysqli - mysqli.c: Fix unused variables, they are only used in non-mysqlnd mode - mysqli_api.c (PHP_5_3 only): Fix constness, add_property_string expects a char *, not a const char * - mysqli_prop.c: Cast to long, as its below the LONG_MAX and therefore safe - mysqli_result_iterator.c: Cast to ulong as the iterator member expects that rather than a my_longlong # In trunk only warnings regarding the zend_property_info # structure is present and PHP_5_3 is warning free now Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c U php/php-src/trunk/ext/mysqli/mysqli.c U php/php-src/trunk/ext/mysqli/mysqli_prop.c U php/php-src/trunk/ext/mysqli/mysqli_result_iterator.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-10-05 09:40:36 UTC (rev 304070) @@ -1047,11 +1047,11 @@ /* {{{ php_add_field_properties */ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC) { - add_property_string(value, name,(field-name ? field-name : ), 1); - add_property_string(value, orgname,(field-org_name ? field-org_name : ), 1); - add_property_string(value, table,(field-table ? field-table : ), 1); - add_property_string(value, orgtable,(field-org_table ? field-org_table : ), 1); - add_property_string(value, def,(field-def ? field-def : ), 1); + add_property_string(value, name, (char *) (field-name ? field-name : ), 1); + add_property_string(value, orgname, (char *) (field-org_name ? field-org_name : ), 1); + add_property_string(value, table, (char *) (field-table ? field-table : ), 1); + add_property_string(value, orgtable, (char *) (field-org_table ? field-org_table : ), 1); + add_property_string(value, def, (field-def ? field-def : ), 1); add_property_long(value, max_length, field-max_length); add_property_long(value, length, field-length); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -84,7 +84,7 @@ } else {\ l = (__ret_type)__int_func(p);\ if (l LONG_MAX) {\ - ZVAL_LONG(*retval, l);\ + ZVAL_LONG(*retval, (long) l);\ } else { \ char *ret; \ int ret_len = spprintf(ret, 0, __ret_type_sprint_mod, l); \ @@ -178,7 +178,7 @@ } if (rc LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(ret, 0, MYSQLI_LLU_SPEC, rc); @@ -295,7 +295,7 @@ } if (rc LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(ret, 0, MYSQLI_LLU_SPEC, rc); Modified: php/php-src/trunk/ext/mysqli/mysqli.c === --- php/php-src/trunk/ext/mysqli/mysqli.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/trunk/ext/mysqli/mysqli.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -1087,12 +1087,12 @@ */ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC) { +#if !defined(MYSQLI_USE_MYSQLND) MYSQL_ROW row; unsigned inti; MYSQL_FIELD *fields; unsigned long *field_len; - -#if !defined(MYSQLI_USE_MYSQLND) + if (!(row = mysql_fetch_row(result))) { RETURN_NULL(); } Modified: php/php-src/trunk/ext/mysqli/mysqli_prop.c === --- php/php-src/trunk/ext/mysqli/mysqli_prop.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/trunk/ext/mysqli/mysqli_prop.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -84,7 +84,7 @@ } else {\ l = (__ret_type)__int_func(p);\ if (l LONG_MAX) {\ - ZVAL_LONG(*retval, l);\ + ZVAL_LONG(*retval, (long) l);\ } else { \
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/mysqli_prop.c trunk/ext/mysqli/mysqli.c trunk/ext/mysqli/mysqli_prop.c trunk/ext/mysqli/mysqli_res
Kalle Sommer Nielsen wrote: kalleTue, 05 Oct 2010 09:40:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=304070 Log: Fixed compiler warnings in mysqli - mysqli.c: Fix unused variables, they are only used in non-mysqlnd mode - mysqli_api.c (PHP_5_3 only): Fix constness, add_property_string expects a char *, not a const char * I left these for reasons, so merges are easier. These warnings don't hurt much, do they? - mysqli_prop.c: Cast to long, as its below the LONG_MAX and therefore safe - mysqli_result_iterator.c: Cast to ulong as the iterator member expects that rather than a my_longlong # In trunk only warnings regarding the zend_property_info # structure is present and PHP_5_3 is warning free now Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c U php/php-src/trunk/ext/mysqli/mysqli.c U php/php-src/trunk/ext/mysqli/mysqli_prop.c U php/php-src/trunk/ext/mysqli/mysqli_result_iterator.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-10-05 09:40:36 UTC (rev 304070) @@ -1047,11 +1047,11 @@ /* {{{ php_add_field_properties */ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field TSRMLS_DC) { - add_property_string(value, name,(field-name ? field-name : ), 1); - add_property_string(value, orgname,(field-org_name ? field-org_name : ), 1); - add_property_string(value, table,(field-table ? field-table : ), 1); - add_property_string(value, orgtable,(field-org_table ? field-org_table : ), 1); - add_property_string(value, def,(field-def ? field-def : ), 1); + add_property_string(value, name, (char *) (field-name ? field-name : ), 1); + add_property_string(value, orgname, (char *) (field-org_name ? field-org_name : ), 1); + add_property_string(value, table, (char *) (field-table ? field-table : ), 1); + add_property_string(value, orgtable, (char *) (field-org_table ? field-org_table : ), 1); + add_property_string(value, def, (field-def ? field-def : ), 1); add_property_long(value, max_length, field-max_length); add_property_long(value, length, field-length); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_prop.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -84,7 +84,7 @@ } else {\ l = (__ret_type)__int_func(p);\ if (l LONG_MAX) {\ - ZVAL_LONG(*retval, l);\ + ZVAL_LONG(*retval, (long) l);\ } else { \ char *ret; \ int ret_len = spprintf(ret, 0, __ret_type_sprint_mod, l); \ @@ -178,7 +178,7 @@ } if (rc LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(ret, 0, MYSQLI_LLU_SPEC, rc); @@ -295,7 +295,7 @@ } if (rc LONG_MAX) { - ZVAL_LONG(*retval, rc); + ZVAL_LONG(*retval, (long) rc); } else { char *ret; int l = spprintf(ret, 0, MYSQLI_LLU_SPEC, rc); Modified: php/php-src/trunk/ext/mysqli/mysqli.c === --- php/php-src/trunk/ext/mysqli/mysqli.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/trunk/ext/mysqli/mysqli.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -1087,12 +1087,12 @@ */ void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC) { +#if !defined(MYSQLI_USE_MYSQLND) MYSQL_ROW row; unsigned inti; MYSQL_FIELD *fields; unsigned long *field_len; - -#if !defined(MYSQLI_USE_MYSQLND) + if (!(row = mysql_fetch_row(result))) { RETURN_NULL(); } Modified: php/php-src/trunk/ext/mysqli/mysqli_prop.c === --- php/php-src/trunk/ext/mysqli/mysqli_prop.c 2010-10-05 09:20:03 UTC (rev 304069) +++ php/php-src/trunk/ext/mysqli/mysqli_prop.c 2010-10-05 09:40:36 UTC (rev 304070) @@ -84,7 +84,7 @@ } else {\ l = (__ret_type)__int_func(p);\ if (l LONG_MAX) {\ -
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/php_mysqli_structs.h
andrey Mon, 14 Jun 2010 18:19:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=300436 Log: And a fix for MySQL Server which is pre 5.1.23, which doesn't support preserving of the charset when performing change_user. This is libmysql only code. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-06-14 17:16:20 UTC (rev 300435) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-06-14 18:19:13 UTC (rev 300436) @@ -521,18 +521,35 @@ char*user, *password, *dbname; int user_len, password_len, dbname_len; ulong rc; +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + const CHARSET_INFO * old_charset; +#endif if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Osss, mysql_link, mysqli_link_class_entry, user, user_len, password, password_len, dbname, dbname_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + old_charset = mysql-mysql-charset; +#endif + rc = mysql_change_user(mysql-mysql, user, password, dbname); MYSQLI_REPORT_MYSQL_ERROR(mysql-mysql); if (rc) { RETURN_FALSE; } +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + if (mysql_get_server_version(mysql-mysql) 501023L) { + /* + Request the current charset, or it will be reset to the system one. + 5.0 doesn't support it. Support added in 5.1.23 by fixing the following bug : + Bug #30472 libmysql doesn't reset charset, insert_id after succ. mysql_change_user() call + */ + rc = mysql_set_character_set(mysql-mysql, old_charset-csname); + } +#endif RETURN_TRUE; } Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2010-06-14 17:16:20 UTC (rev 300435) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2010-06-14 18:19:13 UTC (rev 300436) @@ -40,8 +40,44 @@ #include ext/mysqlnd/mysqlnd.h #include mysqli_mysqlnd.h #else + +/* + The libmysql headers (a PITA) also define it and there will be an warning. + Undef it and later we might need to define it again. +*/ +#ifdef HAVE_MBRLEN +#undef HAVE_MBRLEN +#define WE_HAD_MBRLEN +#endif +#ifdef HAVE_MBSTATE_T +#undef HAVE_MBSTATE_T +#define WE_HAD_MBSTATE_T +#endif + +#include my_global.h + +#if !defined(HAVE_MBRLEN) defined(WE_HAD_MBRLEN) +#define HAVE_MBRLEN 1 +#endif + +#if !defined(HAVE_MBSTATE_T) defined(WE_HAD_MBSTATE_T) +#define HAVE_MBSTATE_T 1 +#endif + +/* + We need more than mysql.h because we need CHARSET_INFO in one place. + This order has been borrowed from the ODBC driver. Nothing can be removed + from the list of headers :( +*/ + +#include my_sys.h #include mysql.h #include errmsg.h +#include my_list.h +#include m_string.h +#include mysqld_error.h +#include my_list.h +#include m_ctype.h #include mysqli_libmysql.h #endif Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-06-14 17:16:20 UTC (rev 300435) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-06-14 18:19:13 UTC (rev 300436) @@ -521,18 +521,35 @@ char*user, *password, *dbname; int user_len, password_len, dbname_len; ulong rc; +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + const CHARSET_INFO * old_charset; +#endif if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Osss, mysql_link, mysqli_link_class_entry, user, user_len, password, password_len, dbname, dbname_len) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + old_charset = mysql-mysql-charset; +#endif + rc = mysql_change_user(mysql-mysql, user, password, dbname); MYSQLI_REPORT_MYSQL_ERROR(mysql-mysql); if (rc) { RETURN_FALSE; } +#if !defined(MYSQLI_USE_MYSQLND) defined(HAVE_MYSQLI_SET_CHARSET) + if
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/tests/mysqli_stmt_attr_
uw Mon, 31 May 2010 12:10:04 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299983 Log: Fixing mysqli_stmt_attr_set @ libmysql Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-05-31 12:02:55 UTC (rev 299982) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-05-31 12:10:04 UTC (rev 299983) @@ -2219,7 +2219,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (FALSE == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #endif Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-05-31 12:02:55 UTC (rev 299982) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-05-31 12:10:04 UTC (rev 299983) @@ -45,18 +45,15 @@ printf([005] Expecting NULL, got %s/%s\n, gettype($tmp), $tmp); $stmt-prepare(SELECT * FROM test); - + mt_srand(microtime(true)); - /* mysqlnd detects invalid attributes, libmysql does not AFAIK */ - $invalid_ret = ($IS_MYSQLND) ? false : true; - for ($i = -100; $i 1000; $i++) { if (in_array($i, $valid_attr)) continue; $invalid_attr = $i; - if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { - printf([006a] Expecting boolean/%s for attribute %d, got %s/%s\n, $invalid_ret, $invalid_attr, gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { + printf([006a] Expecting boolean/false for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); } } @@ -64,8 +61,8 @@ do { $invalid_attr = mt_rand(-1 * (min(4294967296, PHP_INT_MAX) + 1), min(4294967296, PHP_INT_MAX)); } while (in_array($invalid_attr, $valid_attr)); - if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { - printf([006b] Expecting boolean/%s for attribute %d, got %s/%s\n, $invalid_ret, $invalid_attr, gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { + printf([006b] Expecting boolean/false for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); } } $stmt-close(); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-31 12:02:55 UTC (rev 299982) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-31 12:10:04 UTC (rev 299983) @@ -2219,7 +2219,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (FALSE == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #endif Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-05-31 12:02:55 UTC (rev 299982) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2010-05-31 12:10:04 UTC (rev 299983) @@ -45,18 +45,15 @@ printf([005] Expecting NULL, got %s/%s\n, gettype($tmp), $tmp); $stmt-prepare(SELECT * FROM test); - + mt_srand(microtime(true)); - /* mysqlnd detects invalid attributes, libmysql does not AFAIK */ - $invalid_ret = ($IS_MYSQLND) ? false : true; - for ($i = -100; $i 1000; $i++) { if (in_array($i, $valid_attr)) continue; $invalid_attr = $i; - if ($invalid_ret !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { - printf([006a] Expecting boolean/%s for attribute %d, got %s/%s\n, $invalid_ret, $invalid_attr, gettype($tmp), $tmp); + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) { + printf([006a]
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
andrey Thu, 27 May 2010 12:44:10 + Revision: http://svn.php.net/viewvc?view=revisionrevision=299849 Log: Check before use, because mysqlnd can return NULL and this will crash. However, this can happen only in case of OOM. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-05-27 12:39:12 UTC (rev 299848) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2010-05-27 12:44:10 UTC (rev 299849) @@ -453,10 +453,13 @@ { unsigned int i; MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind(stmt-stmt); - for (i = 0; i (argc - start); i++) { - params[i].zv = *(args[i + start]); + if (params) { + for (i = 0; i (argc - start); i++) { + params[i].zv = *(args[i + start]); + } + return mysqlnd_stmt_bind_result(stmt-stmt, params); } - return mysqlnd_stmt_bind_result(stmt-stmt, params); + return FAIL; } #endif /* }}} */ Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-27 12:39:12 UTC (rev 299848) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2010-05-27 12:44:10 UTC (rev 299849) @@ -453,10 +453,13 @@ { unsigned int i; MYSQLND_RESULT_BIND * params = mysqlnd_stmt_alloc_result_bind(stmt-stmt); - for (i = 0; i (argc - start); i++) { - params[i].zv = *(args[i + start]); + if (params) { + for (i = 0; i (argc - start); i++) { + params[i].zv = *(args[i + start]); + } + return mysqlnd_stmt_bind_result(stmt-stmt, params); } - return mysqlnd_stmt_bind_result(stmt-stmt, params); + return FAIL; } #endif /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h branches/PHP_5_3/ext/mysqlnd/mysqlnd_wi
andrey Wed, 23 Dec 2009 11:58:45 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292528 Log: Unify. The typedef-ed structs in mysqlnd are always capitalized. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_nonapi.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h U php/php-src/trunk/ext/mysqlnd/mysqlnd_wireprotocol.h Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2009-12-23 10:38:29 UTC (rev 292527) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c 2009-12-23 11:58:45 UTC (rev 292528) @@ -1760,7 +1760,7 @@ memcpy(last_error, stmt-stmt-last_error, MYSQL_ERRMSG_SIZE); memcpy(sqlstate, mysql-mysql-net.sqlstate, SQLSTATE_LENGTH+1); #else - mysqlnd_error_info error_info = mysql-mysql-error_info; + MYSQLND_ERROR_INFO error_info = mysql-mysql-error_info; #endif mysqli_stmt_close(stmt-stmt, FALSE); stmt-stmt = NULL; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2009-12-23 10:38:29 UTC (rev 292527) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_nonapi.c 2009-12-23 11:58:45 UTC (rev 292528) @@ -486,7 +486,7 @@ strcpy(s_sqlstate, mysql_sqlstate(mysql-mysql)); s_errno = mysql_errno(mysql-mysql); #else - mysqlnd_error_info error_info = mysql-mysql-error_info; + MYSQLND_ERROR_INFO error_info = mysql-mysql-error_info; #endif MYSQLI_REPORT_MYSQL_ERROR(mysql-mysql); MYSQLI_DISABLE_MQ; Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2009-12-23 10:38:29 UTC (rev 292527) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2009-12-23 11:58:45 UTC (rev 292528) @@ -96,7 +96,7 @@ unsigned int server_status; uint64_t affected_rows; uint64_t last_insert_id; -} mysqlnd_upsert_status; +} MYSQLND_UPSERT_STATUS; typedef struct st_mysqlnd_error_info @@ -104,7 +104,7 @@ char error[MYSQLND_ERRMSG_SIZE+1]; char sqlstate[MYSQLND_SQLSTATE_LENGTH + 1]; unsigned int error_no; -} mysqlnd_error_info; +} MYSQLND_ERROR_INFO; typedef struct st_mysqlnd_infile_info @@ -465,12 +465,12 @@ unsigned long server_capabilities; /* For UPSERT queries */ - mysqlnd_upsert_status upsert_status; + MYSQLND_UPSERT_STATUS upsert_status; char *last_message; unsigned int last_message_len; /* If error packet, we use these */ - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; /* To prevent queries during unbuffered fetches. Also to @@ -544,7 +544,7 @@ unsigned int references; - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; }; @@ -615,9 +615,9 @@ MYSQLND_RESULT_BIND *result_bind; zend_bool result_zvals_separated_once; - mysqlnd_upsert_status upsert_status; + MYSQLND_UPSERT_STATUS upsert_status; - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; zend_bool update_max_length; unsigned longprefetch_rows; Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h === --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 2009-12-23 10:38:29 UTC (rev 292527) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_wireprotocol.h 2009-12-23 11:58:45 UTC (rev 292528) @@ -181,7 +181,7 @@ char *info_or_local_file; size_t info_or_local_file_len; /* If error packet, we use these */ - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; } php_mysql_packet_rset_header; @@ -193,7 +193,7 @@ zend_boolskip_parsing; zend_boolstupid_list_fields_eof; - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; } php_mysql_packet_res_field; @@ -222,7 +222,7 @@ size_t bit_fields_total_len; /* trailing \0 not counted */ /* If error packet, we use these */ - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; }; @@ -246,7 +246,7 @@ unsigned int warning_count; /* present in case of error */ - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; } php_mysql_packet_prepare_response; @@ -258,7 +258,7 @@ /* message_len is not part of the packet*/ uint16_t server_capabilities; /* If error packet, we use these */ - mysqlnd_error_info error_info; + MYSQLND_ERROR_INFO error_info; } php_mysql_packet_chg_user_resp;
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
rasmus Tue, 01 Dec 2009 21:39:19 + Revision: http://svn.php.net/viewvc?view=revisionrevision=291572 Log: Fix broken build. This constant is not in older versions of MySQL. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-12-01 21:23:29 UTC (rev 291571) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-12-01 21:39:19 UTC (rev 291572) @@ -1604,7 +1604,9 @@ #endif #endif /* MYSQLI_USE_MYSQLND */ case MYSQL_OPT_CONNECT_TIMEOUT: +#ifdef MYSQL_REPORT_DATA_TRUNCATION case MYSQL_REPORT_DATA_TRUNCATION: +#endif case MYSQL_OPT_LOCAL_INFILE: case MYSQL_OPT_NAMED_PIPE: #ifdef MYSQL_OPT_PROTOCOL Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-12-01 21:23:29 UTC (rev 291571) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-12-01 21:39:19 UTC (rev 291572) @@ -1657,7 +1657,9 @@ #endif #endif /* MYSQLI_USE_MYSQLND */ case MYSQL_OPT_CONNECT_TIMEOUT: +#ifdef MYSQL_REPORT_DATA_TRUNCATION case MYSQL_REPORT_DATA_TRUNCATION: +#endif case MYSQL_OPT_LOCAL_INFILE: case MYSQL_OPT_NAMED_PIPE: #ifdef MYSQL_OPT_PROTOCOL -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/tests/mysqli_options.phpt
uw Tue, 03 Nov 2009 14:56:04 + Revision: http://svn.php.net/viewvc?view=revisionrevision=290170 Log: Fix for bug #49965 . Let mysqli_options() try to cast option values to the appropriate type. Bug: http://bugs.php.net/49965 (Assigned) Setting MYSQLI_OPT_CONNECT_TIMEOUT does not seem to have an effect on timeout Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_options.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-11-03 13:14:33 UTC (rev 290169) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-11-03 14:56:04 UTC (rev 290170) @@ -1589,6 +1589,66 @@ } /* }}} */ +/* {{{ mysqli_options_get_option_zval_type */ +static int mysqli_options_get_option_zval_type(int option) +{ + switch (option) { +#ifdef MYSQLI_USE_MYSQLND +#if PHP_MAJOR_VERSION = 6 + case MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE: +#endif + case MYSQLND_OPT_NET_CMD_BUFFER_SIZE: + case MYSQLND_OPT_NET_READ_BUFFER_SIZE: +#ifdef MYSQLND_STRING_TO_INT_CONVERSION + case MYSQLND_OPT_INT_AND_FLOAT_NATIVE: +#endif +#endif /* MYSQLI_USE_MYSQLND */ + case MYSQL_OPT_CONNECT_TIMEOUT: +case MYSQL_REPORT_DATA_TRUNCATION: +case MYSQL_OPT_LOCAL_INFILE: +case MYSQL_OPT_NAMED_PIPE: +#ifdef MYSQL_OPT_PROTOCOL +case MYSQL_OPT_PROTOCOL: +#endif /* MySQL 4.1.0 */ +#ifdef MYSQL_OPT_READ_TIMEOUT + case MYSQL_OPT_READ_TIMEOUT: + case MYSQL_OPT_WRITE_TIMEOUT: + case MYSQL_OPT_GUESS_CONNECTION: + case MYSQL_OPT_USE_EMBEDDED_CONNECTION: + case MYSQL_OPT_USE_REMOTE_CONNECTION: + case MYSQL_SECURE_AUTH: +#endif /* MySQL 4.1.1 */ +#ifdef MYSQL_OPT_RECONNECT + case MYSQL_OPT_RECONNECT: +#endif /* MySQL 5.0.13 */ +#ifdef MYSQL_OPT_SSL_VERIFY_SERVER_CERT +case MYSQL_OPT_SSL_VERIFY_SERVER_CERT: +#endif /* MySQL 5.0.23 */ +#ifdef MYSQL_OPT_COMPRESS + case MYSQL_OPT_COMPRESS: +#endif /* mysqlnd @ PHP 5.3.2 */ + return IS_LONG; + +#ifdef MYSQL_SHARED_MEMORY_BASE_NAME +case MYSQL_SHARED_MEMORY_BASE_NAME: +#endif /* MySQL 4.1.0 */ +#ifdef MYSQL_SET_CLIENT_IP + case MYSQL_SET_CLIENT_IP: +#endif /* MySQL 4.1.1 */ + case MYSQL_READ_DEFAULT_FILE: + case MYSQL_READ_DEFAULT_GROUP: + case MYSQL_INIT_COMMAND: + case MYSQL_SET_CHARSET_NAME: + case MYSQL_SET_CHARSET_DIR: + return IS_STRING; + + default: + return IS_NULL; + } +} +/* }}} */ + + /* {{{ proto bool mysqli_options(object link, int flags, mixed values) Set options */ PHP_FUNCTION(mysqli_options) @@ -1599,6 +1659,7 @@ longmysql_option; unsigned intl_value; longret; + int expected_type; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Olz, mysql_link, mysqli_link_class_entry, mysql_option, mysql_value) == FAILURE) { return; @@ -1610,16 +1671,30 @@ RETURN_FALSE; } } - - switch (Z_TYPE_PP(mysql_value)) { + expected_type = mysqli_options_get_option_zval_type(mysql_option); + if (expected_type != Z_TYPE_P(mysql_value)) { + switch (expected_type) { + case IS_STRING: + convert_to_string_ex(mysql_value); + break; + case IS_LONG: + convert_to_long_ex(mysql_value); + break; + default: + break; + } + } + switch (expected_type) { case IS_STRING: ret = mysql_options(mysql-mysql, mysql_option, Z_STRVAL_PP(mysql_value)); break; - default: - convert_to_long_ex(mysql_value); + case IS_LONG: l_value = Z_LVAL_PP(mysql_value); ret = mysql_options(mysql-mysql, mysql_option, (char *)l_value); break; + default: + ret = 1; + break; } RETURN_BOOL(!ret); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
andrey Fri, 25 Sep 2009 10:52:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288743 Log: Fix error code checking for mysql_stmt_attr_set. There is a test that checks this. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 10:42:09 UTC (rev 288742) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 10:52:29 UTC (rev 288743) @@ -2128,7 +2128,11 @@ } mode = mode_in; - if ((rc = mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode))) { +#if !defined(MYSQLI_USE_MYSQLND) + if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { +#else + if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { +#endif RETURN_FALSE; } RETURN_TRUE; Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 10:42:09 UTC (rev 288742) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 10:52:29 UTC (rev 288743) @@ -2190,7 +2190,11 @@ } mode = mode_in; - if ((rc = mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode))) { +#if !defined(MYSQLI_USE_MYSQLND) + if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { +#else + if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { +#endif RETURN_FALSE; } RETURN_TRUE; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
andrey Fri, 25 Sep 2009 10:55:06 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288746 Log: Remove unused variable Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 10:54:16 UTC (rev 288745) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 10:55:06 UTC (rev 288746) @@ -2115,7 +2115,6 @@ longmode_in; ulong mode; ulong attr; - int rc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Oll, mysql_stmt, mysqli_stmt_class_entry, attr, mode_in) == FAILURE) { return; Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 10:54:16 UTC (rev 288745) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 10:55:06 UTC (rev 288746) @@ -2177,7 +2177,6 @@ longmode_in; ulong mode; ulong attr; - int rc; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), Oll, mysql_stmt, mysqli_stmt_class_entry, attr, mode_in) == FAILURE) { return; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/tests/mysqli_stmt_attr_
andrey Fri, 25 Sep 2009 12:25:54 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288784 Log: Fix mysqli_stmt_attr_set in libmysql mode. mysql_stmt_attr_set returns my_bool instead of int. If it was int, then 0 is success and !0 is failure, but for my_bool 0 (FALSE) is failure and !0 is success. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-25 12:25:54 UTC (rev 288784) @@ -2128,7 +2128,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (FALSE == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #endif Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:25:54 UTC (rev 288784) @@ -58,7 +58,7 @@ do { $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); } while (in_array($invalid_attr, $valid_attr)); - if (true !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf([006b] Expecting boolean/true for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); } @@ -265,4 +265,4 @@ require_once(clean_table.inc); ? --EXPECTF-- -done! \ No newline at end of file +done! Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-25 12:25:54 UTC (rev 288784) @@ -2190,7 +2190,7 @@ mode = mode_in; #if !defined(MYSQLI_USE_MYSQLND) - if (mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { + if (FALSE == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #else if (FAIL == mysql_stmt_attr_set(stmt-stmt, attr, (void *)mode)) { #endif Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt === --- php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:05:15 UTC (rev 288783) +++ php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt 2009-09-25 12:25:54 UTC (rev 288784) @@ -58,7 +58,7 @@ do { $invalid_attr = mt_rand(-1 * PHP_INT_MAX + 1, PHP_INT_MAX); } while (in_array($invalid_attr, $valid_attr)); - if (true !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) + if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, $invalid_attr, 0))) /* Although it may be desired to get false neither the MySQL Client Library nor mysqlnd are supposed to detect invalid codes */ printf([006b] Expecting boolean/true for attribute %d, got %s/%s\n, $invalid_attr, gettype($tmp), $tmp); } @@ -265,4 +265,4 @@ require_once(clean_table.inc); ? --EXPECTF-- -done! \ No newline at end of file +done! -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqli/ mysqli_api.c
andrey Tue, 22 Sep 2009 13:59:29 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288571 Log: MFH: Fix handling of BIT fields in mysqli, when libmysql is used We need to use macros from mysqlnd to be able to read the bit fields, as they are specially encoded. mysqlnd is always there, 5.3+, so its macros can be used, even if mysqlnd is not compiled as library of choice. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-22 13:58:52 UTC (rev 288570) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-22 13:59:29 UTC (rev 288571) @@ -31,6 +31,7 @@ #include php_globals.h #include ext/standard/info.h #include php_mysqli_structs.h +#include ext/mysqlnd/mysqlnd_portability.h /* {{{ proto mixed mysqli_affected_rows(object link) Get number of affected rows in previous MySQL operation */ @@ -356,6 +357,7 @@ bind[ofs].is_null = stmt-result.is_null[ofs]; bind[ofs].buffer_length = stmt-result.buf[ofs].buflen; bind[ofs].is_unsigned = (stmt-stmt-fields[ofs].flags UNSIGNED_FLAG) ? 1 : 0; + bind[ofs].length = stmt-result.buf[ofs].output_len; break; case MYSQL_TYPE_DATE: @@ -880,9 +882,29 @@ ZVAL_DOUBLE(stmt-result.vars[i], *(double *)stmt-result.buf[i].val); break; case IS_STRING: - if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_LONGLONG) { + if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_LONGLONG +#if MYSQL_VERSION_ID 50002 +|| stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_BIT +#endif +) { my_bool uns= (stmt-stmt-fields[i].flags UNSIGNED_FLAG)? 1:0; - llval= *(my_ulonglong *) stmt-result.buf[i].val; +#if MYSQL_VERSION_ID 50002 + if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_BIT) { + switch (stmt-result.buf[i].output_len) { + case 8:llval = (my_ulonglong) bit_uint8korr(stmt-result.buf[i].val);break; + case 7:llval = (my_ulonglong) bit_uint7korr(stmt-result.buf[i].val);break; + case 6:llval = (my_ulonglong) bit_uint6korr(stmt-result.buf[i].val);break; + case 5:llval = (my_ulonglong) bit_uint5korr(stmt-result.buf[i].val);break; + case 4:llval = (my_ulonglong) bit_uint4korr(stmt-result.buf[i].val);break; + case 3:llval = (my_ulonglong) bit_uint3korr(stmt-result.buf[i].val);break; + case 2:llval = (my_ulonglong) bit_uint2korr(stmt-result.buf[i].val);break; + case 1:llval = (my_ulonglong) uint1korr(stmt-result.buf[i].val);break; + } + } else +#endif + { + llval= *(my_ulonglong *) stmt-result.buf[i].val; + } #if SIZEOF_LONG==8 if (uns llval 9223372036854775807L) { #elif SIZEOF_LONG==4 @@ -901,14 +923,7 @@ } else { ZVAL_LONG(stmt-result.vars[i], llval); } - } -#if MYSQL_VERSION_ID 50002 - else if (stmt-stmt-bind[i].buffer_type == MYSQL_TYPE_BIT) { - llval = *(my_ulonglong *)stmt-result.buf[i].val; -
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h branches/PHP_5_3/ext/mysqli/tests/005.phpt trunk/ext/mysqli/mysqli_api.c trun
Jani Taskinen schrieb: What about fixing it also in PHP_5_2 ?? Or doesn't this exist there? ;) Sounds quite critical to be in there.. Good question. A precondition for the crash to happen is that ext/mysqli allocates a too small result buffer. This could happen due to bug which broke BC in 5.3.0. That bug has been fixed in the commit immerdiately followed after this commit: http://news.php.net/php.cvs/60379 I was wrong that the crash can be reproduced with the test 005.phpt and PHP 5.0.x-5.2.x. I checked again and found that I had messed up my PHP sources causing a similar but unrelated crash. I also checked a couple of SQL statements that caused headaches during the mysqlnd development (e.g. SELECT UNION) and the MySQL bugs database for a bug which may lead to a too small result buffer in order to break ext/mysqli: without success. Anyway, I can patch PHP 5.2 as well, just in case someone finds a way to make a current MySQL server report faulty meta data (length must be reported as 0 but the actual data returned needs to be longer than 256 bytes). Ulf -- Ulf Wendel, MySQL Sun Microsystems GmbH, Sonnenallee 1, D-85551 Kirchheim-Heimstetten Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer Vorsitzender des Aufsichtsrates: Martin Haering Muenchen: HRB161028 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h branches/PHP_5_3/ext/mysqli/tests/005.phpt trunk/ext/mysqli/mysqli_api.c trunk/ex
uw Fri, 11 Sep 2009 12:16:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288263 Log: Fixing a crash which must have existed since PHP 5.0. At least the crash can be reproduced with PHP 5.0.6. The crash happens only when using the MySQL Client Library (libmysql) - it does not happen when using mysqlnd. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqli/tests/005.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt-result.buf[ofs].val; bind[ofs].is_null = stmt-result.is_null[ofs]; bind[ofs].buffer_length = stmt-result.buf[ofs].buflen; - bind[ofs].length = stmt-result.buf[ofs].buflen; + bind[ofs].length = stmt-result.buf[ofs].output_len; break; } default: @@ -916,7 +916,7 @@ { #endif ZVAL_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, - stmt-result.buf[i].buflen, 1); + stmt-result.buf[i].output_len, 1); } } break; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 12:16:56 UTC (rev 288263) @@ -73,8 +73,9 @@ }; typedef struct { + char*val; ulong buflen; - char*val; + ulong output_len; ulong type; } VAR_BUFFER; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 12:16:56 UTC (rev 288263) @@ -32,6 +32,9 @@ var_dump($test); + /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ + mysqli_fetch($stmt); + mysqli_stmt_close($stmt); mysqli_query($link, DROP TABLE IF EXISTS test_bind_fetch); mysqli_close($link); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt-result.buf[ofs].val; bind[ofs].is_null = stmt-result.is_null[ofs]; bind[ofs].buffer_length = stmt-result.buf[ofs].buflen; - bind[ofs].length = stmt-result.buf[ofs].buflen; + bind[ofs].length = stmt-result.buf[ofs].output_len; break; } default: @@ -955,7 +955,7 @@ } else #endif { - copy_len = stmt-result.buf[i].buflen; + copy_len = stmt-result.buf[i].output_len; } if (!IS_BINARY_DATA(fields[i])) { ZVAL_UTF8_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, Modified: php/php-src/trunk/ext/mysqli/php_mysqli_structs.h
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c
uw Fri, 11 Sep 2009 12:28:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288265 Log: Stepping back to PHP 5.2.x and earlier logic of allocating even huge pieces of memory for large BLOB types to avoid data truncation. This fixes the test failure of 005.phpt when using MySQL Client Library (libmysql). The test does pass with mysqlnd because mysqlnd does not have any issues here. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:27:29 UTC (rev 288264) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:28:47 UTC (rev 288265) @@ -395,7 +395,9 @@ different lengths and you will see that we get different lengths in stmt-stmt-fields[ofs].length The just take 256 and saves us from realloc-ing. */ - stmt-result.buf[ofs].buflen = 256; + stmt-result.buf[ofs].buflen = + (stmt-stmt-fields) ? (stmt-stmt-fields[ofs].length) ? stmt-stmt-fields[ofs].length + 1: 256: 256; + } else { /* the user has called store_result(). if he does not there is no way to determine the Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:27:29 UTC (rev 288264) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:28:47 UTC (rev 288265) @@ -395,7 +395,9 @@ different lengths and you will see that we get different lengths in stmt-stmt-fields[ofs].length The just take 256 and saves us from realloc-ing. */ - stmt-result.buf[ofs].buflen = 256; + stmt-result.buf[ofs].buflen = + (stmt-stmt-fields) ? (stmt-stmt-fields[ofs].length) ? stmt-stmt-fields[ofs].length + 1: 256: 256; + } else { /* the user has called store_result(). if he does not there is no way to determine the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h branches/PHP_5_3/ext/mysqli/tests/005.phpt trunk/ext/mysqli/mysqli_api.c trun
What about fixing it also in PHP_5_2 ?? Or doesn't this exist there? ;) Sounds quite critical to be in there.. --Jani On 09/11/2009 03:16 PM, Ulf Wendel wrote: uw Fri, 11 Sep 2009 12:16:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288263 Log: Fixing a crash which must have existed since PHP 5.0. At least the crash can be reproduced with PHP 5.0.6. The crash happens only when using the MySQL Client Library (libmysql) - it does not happen when using mysqlnd. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqli/tests/005.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt-result.buf[ofs].val; bind[ofs].is_null =stmt-result.is_null[ofs]; bind[ofs].buffer_length = stmt-result.buf[ofs].buflen; - bind[ofs].length =stmt-result.buf[ofs].buflen; + bind[ofs].length =stmt-result.buf[ofs].output_len; break; } default: @@ -916,7 +916,7 @@ { #endif ZVAL_STRINGL(stmt-result.vars[i], stmt-result.buf[i].val, - stmt-result.buf[i].buflen, 1); + stmt-result.buf[i].output_len, 1); } } break; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h === --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-09-11 12:16:56 UTC (rev 288263) @@ -73,8 +73,9 @@ }; typedef struct { + char*val; ulong buflen; - char*val; + ulong output_len; ulong type; } VAR_BUFFER; Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/005.phpt 2009-09-11 12:16:56 UTC (rev 288263) @@ -32,6 +32,9 @@ var_dump($test); + /* this will crash with libmysql from PHP 5.0.6 (or earlier) to 5.3.0 */ + mysqli_fetch($stmt); + mysqli_stmt_close($stmt); mysqli_query($link, DROP TABLE IF EXISTS test_bind_fetch); mysqli_close($link); Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 11:50:03 UTC (rev 288262) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:16:56 UTC (rev 288263) @@ -409,7 +409,7 @@ bind[ofs].buffer = stmt-result.buf[ofs].val; bind[ofs].is_null =stmt-result.is_null[ofs]; bind[ofs].buffer_length = stmt-result.buf[ofs].buflen; - bind[ofs].length =stmt-result.buf[ofs].buflen; + bind[ofs].length =stmt-result.buf[ofs].output_len; break; } default: @@ -955,7 +955,7 @@ } else #endif { - copy_len = stmt-result.buf[i].buflen; + copy_len = stmt-result.buf[i].output_len; } if (!IS_BINARY_DATA(fields[i])) {
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt trunk/ext/mysqli/mysqli_api.c trunk/ext/mysqli/tests/mysqli_stmt_fet
uw Fri, 11 Sep 2009 13:38:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288267 Log: Fix for bug #49357 (MySQLi extension fails to recognize POINT (spatial) colums). Do yourself a favour and use mysqlnd. mysqlnd has no isuses here. If you insist on using the MySQL Client Library (libmysql) I strongly recommend to use mysqli_stmt_store_result() when fetching geometry data using prepared statements. When streaming data, which is the default for prepared statements, ext/mysqli will have to make a guess on the size of the result buffer it needs. The guess is based on a length reported by the MySQL CLient Library (libmysql). The MySQL Client Library reports 4GB (!) for a POINT - a conservative and safe guess. Consequently, ext/mysqli will try to allocate 4GB of RAM. The true (maximum) size of the column is not available before buffering the result on the client using mysqli_stmt_store_result(). If you call mysqli_stmt_store_result(), the result buffers will not get bigger than needed. However, store_result()/buffering is usually not what you want when you ask for prepared statements. Bug: http://bugs.php.net/49357 (Verified) MySQLi extension fails to recognize POINT (spatial) colums Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c U php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt U php/php-src/trunk/ext/mysqli/mysqli_api.c U php/php-src/trunk/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-09-11 13:38:47 UTC (rev 288267) @@ -370,6 +370,7 @@ case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_GEOMETRY: #ifdef FIELD_TYPE_NEWDECIMAL case MYSQL_TYPE_NEWDECIMAL: #endif @@ -2283,7 +2284,8 @@ for (i = mysql_stmt_field_count(stmt-stmt) - 1; i =0; --i) { if (stmt-stmt-fields (stmt-stmt-fields[i].type == MYSQL_TYPE_BLOB || stmt-stmt-fields[i].type == MYSQL_TYPE_MEDIUM_BLOB || - stmt-stmt-fields[i].type == MYSQL_TYPE_LONG_BLOB)) + stmt-stmt-fields[i].type == MYSQL_TYPE_LONG_BLOB || + stmt-stmt-fields[i].type == MYSQL_TYPE_GEOMETRY)) { my_bool tmp=1; mysql_stmt_attr_set(stmt-stmt, STMT_ATTR_UPDATE_MAX_LENGTH, tmp); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt === --- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt 2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt 2009-09-11 13:38:47 UTC (rev 288267) @@ -45,7 +45,7 @@ return false; } - if (!mysqli_stmt_execute($stmt)) { + if (!mysqli_stmt_execute($stmt) || !mysqli_stmt_store_result($stmt)) { printf([%04d] [%d] %s\n, $offset + 8, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); mysqli_stmt_close($stmt); return false; @@ -65,7 +65,7 @@ $num = 0; $rows = array(); - while (true === mysqli_stmt_fetch($stmt)) { + while (true === @mysqli_stmt_fetch($stmt)) { $rows[] = array('id' = $id, 'label' = $bind_res); $num++; } Modified: php/php-src/trunk/ext/mysqli/mysqli_api.c === --- php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 12:47:20 UTC (rev 288266) +++ php/php-src/trunk/ext/mysqli/mysqli_api.c 2009-09-11 13:38:47 UTC (rev 288267) @@ -370,6 +370,7 @@ case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_DECIMAL: + case MYSQL_TYPE_GEOMETRY: #ifdef FIELD_TYPE_NEWDECIMAL case MYSQL_TYPE_NEWDECIMAL: #endif @@ -2346,7 +2347,8 @@ for (i = mysql_stmt_field_count(stmt-stmt) - 1; i =0; --i) { if (stmt-stmt-fields (stmt-stmt-fields[i].type == MYSQL_TYPE_BLOB || stmt-stmt-fields[i].type == MYSQL_TYPE_MEDIUM_BLOB || - stmt-stmt-fields[i].type ==
[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/mysqli/ mysqli_api.c
jani Tue, 04 Aug 2009 14:49:33 + Revision: http://svn.php.net/viewvc?view=revisionrevision=286807 Log: - Revert bad fix for bug #49122 and only enable this when mysqlnd is used Bug: http://bugs.php.net/49122 (Assigned) undefined reference to mysqlnd_stmt_next_result on compile with --with-mysqli Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c === --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-08-04 14:34:44 UTC (rev 286806) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli_api.c2009-08-04 14:49:33 UTC (rev 286807) @@ -1483,8 +1483,7 @@ } /* }}} */ - -#ifdef HAVE_STMT_NEXT_RESULT +#if defined(HAVE_STMT_NEXT_RESULT) defined(MYSQLI_USE_MYSQLND) /* {{{ proto bool mysqli_stmt_next_result(object link) check if there any more query results from a multi query */ PHP_FUNCTION(mysqli_stmt_more_results) @@ -1497,7 +1496,7 @@ } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt, MYSQLI_STATUS_VALID); - RETURN_BOOL(mysql_stmt_more_results(stmt-stmt)); + RETURN_BOOL(mysqlnd_stmt_more_results(stmt-stmt)); } /* }}} */ @@ -1513,7 +1512,7 @@ } MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, mysql_stmt, mysqli_stmt, MYSQLI_STATUS_VALID); - if (!mysql_stmt_more_results(stmt-stmt)) { + if (!mysqlnd_stmt_more_results(stmt-stmt)) { php_error_docref(NULL TSRMLS_CC, E_STRICT, There is no next result set. Please, call mysqli_stmt_more_results()/mysqli_stmt::more_results() to check whether to call this function/method); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php