Edit report at https://bugs.php.net/bug.php?id=67348&edit=1
ID: 67348
Updated by: derick@php.net
Reported by: derick@php.net
Summary: Reading $dbc->stat modifies $dbc->affected_rows
-Status: Analyzed
+Status: Closed
Type: Bug
Package: MySQLi related
Operating System: Linux
PHP Version: 5.6Git-2014-05-27 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of github@derickrethans.nl
Revision: http://git.php.net/?p=php-src.git;a=commit;h=579562176b71820ad49d43b2c841642fef12fe57
Log: Fixed bug #67348: Reading $dbc->stat modifies $dbc->affected_rows
Previous Comments:
------------------------------------------------------------------------
[2018-11-21 10:44:53] kamilcodes at gmail dot com
This is still an issue in PHP 7.2.2
I have spent days trying to figure out why the code I inherited works on the server but not on my
local machine. "mysqli_affected_rows" was the culprit as this is what the previous devs
used quite often.
Is there anyone working on the fix? Is this issue being addressed at all? I would love to contribute
but I do not have the skills, unfortunately.
------------------------------------------------------------------------
[2018-10-18 07:50:04] konrad dot br at brynda dot org
I can confirm that this happens in php 7.2.11 as well.
(mysqli->info: "Rows matched: 1 Changed: 1 Warnings: 0")
------------------------------------------------------------------------
[2018-10-11 22:12:23] gcognault at free dot fr
I can confirm that this happens in php 7.2.11 as well.
------------------------------------------------------------------------
[2018-01-05 14:00:28] steffenbalje at gmail dot com
I can confirm that this happens in php 7.0.22 as well.
------------------------------------------------------------------------
[2017-04-26 13:40:26] fjanisze@php.net
Hello everybody,
the source of all this problem in in $dbc->stat triggering a COM_STATISTICS command to the server
which will update affected_rows to -1. This is expected since no rows were influenced by
COM_STATISTICS so make no sense to keep the old value 1 (or whatever other value we have stored).
Being said that, we're thinking about a removal of the $dbc->stat function which will remove
the trigger of the command to the server, instead $dbc->stat will read the plain value from the
object, this shall fix this problem.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=67348
--
Edit this bug report at https://bugs.php.net/bug.php?id=67348&edit=1