[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 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 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 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