This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244714 - Xdebug: mysqli_affected_rows returns “-1” when it should be “1”
Summary: Xdebug: mysqli_affected_rows returns “-1” when it should be “1”
Status: RESOLVED INCOMPLETE
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 7.4
Hardware: PC Windows 8
: P3 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-25 09:02 UTC by bromelio
Modified: 2014-05-25 13:02 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
1 out of 3 (1.06 KB, application/octet-stream)
2014-05-25 09:37 UTC, bromelio
Details
2 out of 3 (1.14 KB, application/octet-stream)
2014-05-25 09:38 UTC, bromelio
Details
3 out of 3 (907 bytes, application/octet-stream)
2014-05-25 09:38 UTC, bromelio
Details
Screenshot affected_rows = 1 (225.08 KB, image/png)
2014-05-25 13:02 UTC, bromelio
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bromelio 2014-05-25 09:02:23 UTC
The bug has already been described several times both on the Netbeans forum and on Stackoverflow, please be referred to the following links:

http://stackoverflow.com/q/23848434/3253673
http://forums.netbeans.org/topic52344.html
http://stackoverflow.com/q/20508619/3253673
http://stackoverflow.com/a/23853490/3253673

Thank you in advance for your answer!
Comment 1 Ondrej Brejla 2014-05-25 09:06:49 UTC
Attach at least xdebug.log file and sample smallest project where it can be reproduced. NB just shows data sent by xdebug, so it probably sends -1 because of something (probably error in mysql query, or in xdebug).
Comment 2 bromelio 2014-05-25 09:25:01 UTC
Where do I find xdebug.log file, I've already searched my whole computer?
Comment 3 Ondrej Brejla 2014-05-25 09:32:16 UTC
http://xdebug.org/docs/all_settings and xdebug.remote_log option.

And are you really sure that it should return "1" in your case? Have you echoed it in a code? Manual says that -1 is returned when the query returned an error... [1]

And of course read something from comment about how that function works, e.g.:

Example: Ignoring duplicate key errors while inserting some rows containing data provided by user only if they will match specified unique constraint causes returning of -1 value by mysqli->affected_rows even if rows were inserted. (checked on MySQL 5.0.85 linux and php 5.2.9-2 windows). However mysqli->sqlstate returns no error if statement was executed successfully.

Imho it will definitely not be a problem if NB ;)

[1] http://www.php.net/manual/en/mysqli.affected-rows.php
Comment 4 bromelio 2014-05-25 09:37:29 UTC
Created attachment 147425 [details]
1 out of 3
Comment 5 bromelio 2014-05-25 09:38:08 UTC
Created attachment 147426 [details]
2 out of 3
Comment 6 bromelio 2014-05-25 09:38:37 UTC
Created attachment 147427 [details]
3 out of 3
Comment 7 bromelio 2014-05-25 09:43:47 UTC
I've created these 3 files for you to test, please. I've slightly simplified the code (variables declaration in main.php is now static), but should work. The original version, in any case, run without any problems in the web browser, but not in Xdebug (in Xdebug "Error" is echoed, but even then the data is correctly inserted into the database...)
Comment 8 bromelio 2014-05-25 13:02:51 UTC
Created attachment 147430 [details]
Screenshot affected_rows = 1

...in this screenshot you can see in the variables window (on the right) that affected_rows = 1 and still the "if" evaluates to false and Xdebug jumps not to line 85 but 92 upon the next "step into" (F7). Please let me know your thoughts...