Bug #81494 [Com]: Stopped unbuffered query does not throw error

From: Date: Mon, 04 Oct 2021 22:39:30 +0000
Subject: Bug #81494 [Com]: Stopped unbuffered query does not throw error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237030@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81494&edit=1 ID: 81494 Comment by: php-lover-4451 at gmail dot com Reported by: madri2 at gmail dot com Summary: Stopped unbuffered query does not throw error Status: Verified Type: Bug Package: MySQLi related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: https://google.co.ma/url?q=https%3A%2F%2Fa.tvfun.me%2Fvideo%2Fsirroka-al-khafi-ep-1%2F Previous Comments: ------------------------------------------------------------------------ [2021-10-04 22:37:07] php-lover-4451 at gmail dot com https://creativecommons.org/choose/results-one?field_attribute_to_name=tvfun&field_attribute_to_url=https%3A%2F%2Fa.tvfun.me%2Fmosalsalat-torkia%2F&field_commercial=n&field_derivatives=sa&field_format=Text&field_jurisdiction&field_worktitle=Products&q_1=1&q_1=2 ------------------------------------------------------------------------ [2021-10-04 12:35:28] nikic@php.net Oops, some autocomplete messed things up. I only wanted to change the status to Verified... ------------------------------------------------------------------------ [2021-10-04 12:17:36] madri2 at gmail dot com <?php error_reporting(E_ALL); set_time_limit(0); ini_set('memory_limit','2000M'); ini_set('display_errors', true); $dbo = mysqli_connect('localhost', 'xxx', 'yyy', ''); $dbo2 = mysqli_connect('localhost', 'xxx', 'yyy', ''); mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX); $req = $dbo->query("SELECT * FROM mustBeATableBigEnough", MYSQLI_USE_RESULT); $numFound = 0; while ($found = $req->fetch_assoc()) { $numFound++; $req2 = $dbo2->query("SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST WHERE ID = '".$dbo->thread_id."'"); if ($found2 = $req2->fetch_assoc()) { print_r($found2); $dbo2->query("KILL ".$found2['ID']); } $req2->free(); } $req->free(); echo 'numFound : '.$numFound."\n"; it outputs : Array ( [ID] => 2348965 [USER] => yyyyy [HOST] => localhost [DB] => zzzzzz [COMMAND] => Query [TIME] => 0 [STATE] => Sending data [INFO] => SELECT * FROM xxxx [TIME_MS] => 1.708 [STAGE] => 0 [MAX_STAGE] => 0 [PROGRESS] => 0.000 [MEMORY_USED] => 212672 [MAX_MEMORY_USED] => 212672 [EXAMINED_ROWS] => 0 [QUERY_ID] => 554751313 [INFO_BINARY] => SELECT * FROM xxxx [TID] => 3625133 ) Warning: mysqli_result::fetch_assoc(): Error while reading a row in ....testBug.php on line 54 numFound : 52 the table contains millions of entries ------------------------------------------------------------------------ [2021-10-01 14:24:34] nikic@php.net Please provide a full reproducer. ------------------------------------------------------------------------ [2021-10-01 14:22:06] madri2 at gmail dot com Description: ------------ Do an unbuffered mysqli query and do a while to read all results, kill the mysql request in mysql, then php will only trigger a warning when doing fetch_assoc Warning: mysqli_result::fetch_assoc(): Error while reading a row while ($found = $req->fetch_assoc()) { } will only stop the loop when the mysql query is killed, instead of throwing an error I've tried to set mysqli_report(MYSQLI_REPORT_ALL & ~MYSQLI_REPORT_INDEX); but this doesn't change anything Expected result: ---------------- An exception thrown Actual result: -------------- Warning: mysqli_result::fetch_assoc(): Error while reading a row ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81494&edit=1

« previous php.bugs (#237030) next »