Edit report at https://bugs.php.net/bug.php?id=65411&edit=1
ID: 65411 User updated by: tecdoc at ukr dot net Reported by: tecdoc at ukr dot net Summary: die() don't terminate the current script if mysqli::query use MYSQLI_USE_RESULT Status: Not a bug Type: Bug Package: MySQLi related Operating System: Windows 7 32bit PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I use this script. I do export data from this big table in php. when export is doing i check some data and if this have some mistake it is need do die(). But i will find this bug. What problem abut how i use it It is whole script --------------------- <?php $mysqli = new mysqli('localhost', 'root', '', 'db1'); if ($mysqli->connect_error) die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); //ÐÑинÑдиÑелÑÐ½Ð°Ñ ÑÑÑановка запÑоÑов и оÑвеÑов ÐРв кодиÑÐ¾Ð²ÐºÑ utf8 if (!$mysqli->set_charset("utf8")) die('Set Charset Error: ' . $mysqli->error); set_time_limit(0); // // Ð½Ñ ÑобÑвенно полÑÑаем даннÑе $q = "SELECT * FROM tab1"; $result = $mysqli->query($q, MYSQLI_USE_RESULT); // // ÑазбеÑаем ÑезÑлÑÑÐ°Ñ $fp_csv = fopen("d:\\result\\nums-replace.csv", 'w'); $is_first = true; // Ñлаг - пеÑвÑй Ð·Ð°Ñ Ð¾Ð´ на ÑÐ°Ð·Ð±Ð¾Ñ while($row = $result->fetch_array(MYSQLI_ASSOC)) { $row['text'] = iconv("utf-8", "windows-1251", $row['text']); //кодиÑовка if(!empty($row['datum'])) $row['datum'] = str_pad($row['entfalldatum'],8,'0'); //даÑа // запиÑем название колонок if($is_first){ fputcsv($fp_csv, array_keys($row), ";"); $is_first = false; } //check field if(empty($row['index'])) // !!!!!!!!!!!!!!!!!!!!!! die(); // DON'T TERMINATE fputcsv($fp_csv, $row, ";"); } fclose($fp_csv); /* free result set */ $result->free(); /* close connection */ $mysqli->close(); ?> Previous Comments: ------------------------------------------------------------------------ [2013-08-07 14:27:05] johan...@php.net Why do you request lots of data if you don't use it? ------------------------------------------------------------------------ [2013-08-07 11:59:49] tecdoc at ukr dot net because you do script on table with small count of rows do you try did script when table have more than 3 000 000 rows? ------------------------------------------------------------------------ [2013-08-07 10:04:14] johan...@php.net After fixing the error and escaping the ' in the die call die('why don\'t terminated script?'); the script works as expected. I don't now what effect you see as "not terminating" ------------------------------------------------------------------------ [2013-08-07 08:55:40] tecdoc at ukr dot net Description: ------------ Tested on PHP version is 5.4.16 and 5.3.13 die() don't terminate the current script when mysqli::query use MYSQLI_USE_RESULT --- >From manual page: http://www.php.net/mysqli.query#refsect1-mysqli.query-seealso --- Test script: --------------- $mysqli = new mysqli('localhost', 'root', '', 'db1'); if (!$mysqli->set_charset("utf8")) die('Set Charset Error: ' . $mysqli->error); // tab - it is a table that have more than 3 000 000 rows $q = "SELECT * FROM tab1"; // open query and try close all $result = $mysqli->query($q, MYSQLI_USE_RESULT); $result->free(); $mysqli->close(); die('why don't terminated script?'); // this end of script don't terminate also $result = $mysqli->query($q, MYSQLI_USE_RESULT); $result->free(); $thread = $mysqli->thread_id; $mysqli->kill($thread); $mysqli->close(); die('why don't terminated script?'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65411&edit=1