From: Ulf Wendel Date: Fri, 11 Sep 2009 12:28:47 +0000 (+0000) Subject: Stepping back to PHP 5.2.x and earlier logic of allocating even huge pieces of memory... X-Git-Tag: php-5.4.0alpha1~191^2~2665 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a69c19879090afb7f58008c5ca3d95bab1f81fdf;p=php 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. --- diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index f69f6e7634..7d367e670c 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -395,7 +395,9 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, 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