uw                                       Fri, 11 Sep 2009 12:28:47 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=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.c        2009-09-11 
12:27:29 UTC (rev 288264)
+++ php/php-src/branches/PHP_5_3/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

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

Reply via email to