From a69c19879090afb7f58008c5ca3d95bab1f81fdf Mon Sep 17 00:00:00 2001 From: Ulf Wendel Date: Fri, 11 Sep 2009 12:28:47 +0000 Subject: [PATCH] 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. --- ext/mysqli/mysqli_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.50.1