@@ -105,10 +105,11 @@ public function rawQuery($query, $bindParams = NULL)
105
105
$ params = array ('' ); // Create the empty 0 index
106
106
foreach ($ bindParams as $ prop => $ val ) {
107
107
$ params [0 ] .= $ this ->_determineType ($ val );
108
- array_push ($ params , & $ bindParams [$ prop ]);
108
+ array_push ($ params , $ bindParams [$ prop ]);
109
109
}
110
110
111
- call_user_func_array (array ($ stmt , 'bind_param ' ), $ params );
111
+ call_user_func_array (array ($ stmt , "bind_param " ),$ this ->refValues ($ params ));
112
+
112
113
}
113
114
114
115
$ stmt ->execute ();
@@ -354,21 +355,21 @@ protected function _buildQuery($numRows = NULL, $tableData = NULL)
354
355
if ($ hasTableData ) {
355
356
$ this ->_bindParams [0 ] = $ this ->_paramTypeList ;
356
357
foreach ($ tableData as $ prop => $ val ) {
357
- array_push ($ this ->_bindParams , & $ tableData [$ prop ]);
358
+ array_push ($ this ->_bindParams , $ tableData [$ prop ]);
358
359
}
359
360
}
360
361
// Prepare where condition bind parameters
361
362
if ($ hasConditional ) {
362
363
if ($ this ->_where ) {
363
364
$ this ->_bindParams [0 ] .= $ this ->_whereTypeList ;
364
365
foreach ($ this ->_where as $ prop => $ val ) {
365
- array_push ($ this ->_bindParams , & $ this ->_where [$ prop ]);
366
+ array_push ($ this ->_bindParams , $ this ->_where [$ prop ]);
366
367
}
367
368
}
368
369
}
369
370
// Bind parameters to statment
370
371
if ($ hasTableData || $ hasConditional ){
371
- call_user_func_array (array ($ stmt , ' bind_param ' ), $ this ->_bindParams );
372
+ call_user_func_array (array ($ stmt , " bind_param " ), $ this ->refValues ( $ this -> _bindParams ) );
372
373
}
373
374
374
375
return $ stmt ;
@@ -389,10 +390,10 @@ protected function _dynamicBindResults($stmt)
389
390
$ meta = $ stmt ->result_metadata ();
390
391
391
392
while ($ field = $ meta ->fetch_field ()) {
392
- array_push ($ parameters , & $ row [$ field ->name ]);
393
+ array_push ($ parameters , $ row [$ field ->name ]);
393
394
}
394
395
395
- call_user_func_array (array ($ stmt , ' bind_result ' ), $ parameters );
396
+ call_user_func_array (array ($ stmt , " bind_result " ), $ this -> refValues ( $ parameters) );
396
397
397
398
while ($ stmt ->fetch ()) {
398
399
$ x = array ();
@@ -421,4 +422,16 @@ public function __destruct()
421
422
$ this ->_mysqli ->close ();
422
423
}
423
424
425
+ function refValues ($ arr )
426
+ {
427
+ //Reference is required for PHP 5.3+
428
+ if (strnatcmp (phpversion (),'5.3 ' ) >= 0 ) {
429
+ $ refs = array ();
430
+ foreach ($ arr as $ key => $ value )
431
+ $ refs [$ key ] = &$ arr [$ key ];
432
+ return $ refs ;
433
+ }
434
+ return $ arr ;
435
+ }
436
+
424
437
} // END class
0 commit comments