File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -769,6 +769,9 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
769769 {
770770 $ parameters = array ();
771771 $ results = array ();
772+ // See http://php.net/manual/en/mysqli-result.fetch-fields.php
773+ $ mysqlLongType = 252 ;
774+ $ shouldStoreResult = false ;
772775
773776 $ meta = $ stmt ->result_metadata ();
774777
@@ -780,13 +783,17 @@ protected function _dynamicBindResults(mysqli_stmt $stmt)
780783
781784 $ row = array ();
782785 while ($ field = $ meta ->fetch_field ()) {
786+ if ($ field ->type == $ mysqlLongType )
787+ $ shouldStoreResult = true ;
788+
783789 $ row [$ field ->name ] = null ;
784790 $ parameters [] = & $ row [$ field ->name ];
785791 }
786792
787- // avoid out of memory bug in php 5.2 and 5.3
793+ // avoid out of memory bug in php 5.2 and 5.3. Mysqli allocates lot of memory for long*
794+ // and blob* types. So to avoid out of memory issues store_result is used
788795 // https://github.com/joshcam/PHP-MySQLi-Database-Class/pull/119
789- if (version_compare ( phpversion (), ' 5.4 ' , ' < ' ) )
796+ if ($ shouldStoreResult )
790797 $ stmt ->store_result ();
791798
792799 call_user_func_array (array ($ stmt , 'bind_result ' ), $ parameters );
You can’t perform that action at this time.
0 commit comments