View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001053 | Xdebug | public | 2014-05-25 16:39 | 2014-05-27 22:33 | |
Reporter | bromelio | Assigned To | derick | ||
Priority | immediate | Severity | major | Reproducibility | always |
Status | resolved | Resolution | not fixable | ||
Platform | Netbeans | OS | Windows | OS Version | 8 |
Product Version | 2.2.5 | ||||
Summary | 0001053: Xdebug messes with mysqli_affected_rows($link) | ||||
Description | Please see http://stackoverflow.com/q/23848434/3253673 for a detailed description (particularly the EDIT-section at the bottom). On the attached 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 to code line 92 instead of 85 upon the next "step into" (F7). The issue has also already been encountered by other users, e.g.: 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! | ||||
Steps To Reproduce | -------------------------main.php (1 of 3)------------------------------- <?php require('dbc.inc.php'); $fn = 'Stefan'; $ln = 'Michael'; $u = 'bromelio'; $sn = '23'; $st = 'Stadlerweg'; $cit = 'Elsbethen'; $pc = '5061'; $ct = 'Austria'; $p = 'password1'; $sex = 'm'; $bd = '26'; $bm = '05'; $by = '1983'; $e = 'stefan.michael@hotmail.com'; $user_img = 'example.jpg'; $pn = '00436504167777'; $q = "INSERT INTO users (username, email, pass, first_name, last_name, sex, birth_day, birth_month, birth_year, phone, street, street_nr, city, zip_code, country, user_img) VALUES ('$u', '$e', '$p', '$fn', '$ln', '$sex', '$bd', '$bm', '$by', '$pn', '$st', '$sn', '$cit', '$pc', '$ct', '$user_img')"; $r = mysqli_query($dbc, $q); if (mysqli_affected_rows($dbc) === 1) { //that's where the problem occurs: in the Debugging -> variables window "affected_rows" correctly shows "1"... echo 'Success'; } else { echo 'Error'; //...but stepping into (F7) once more it jumps to "-1" ending up echoing "Error" instead of "Success" } mysqli_close($dbc); ?> ---------------------included "dbc.inc.php" (2 of 3)------------------------- <?php // This file contains the database access information. // This file establishes a connection to MySQL and selects the database. // This file defines a function for making data safe to use in queries. // This file defines a function for hashing passwords. // This script is begun in Chapter 3. // Set the database access information as constants: DEFINE ('DB_USER', 'root'); DEFINE ('DB_PASSWORD', ''); DEFINE ('DB_HOST', 'localhost'); DEFINE ('DB_NAME', 'v'); // Make the connection: $dbc = mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Error connecting to MySQL server.'); // Set the character set: mysqli_set_charset($dbc, 'utf8'); // Function for escaping and trimming form data. // Takes one argument: the data to be treated (string). // Returns the treated data (string). function escape_data ($data, $dbc) { // Strip the slashes if Magic Quotes is on: if (get_magic_quotes_gpc()) $data = stripslashes($data); // Apply trim() and mysqli_real_escape_string(): return mysqli_real_escape_string ($dbc, trim ($data)); } // End of the escape_data() function. // Omit the closing PHP tag to avoid 'headers already sent' errors! | ||||
Additional Information | ----------------------SQL to create table "users" (3 of 3)--------------------- CREATE TABLE IF NOT EXISTS `v`.`users` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `type` ENUM('member','admin') NOT NULL DEFAULT 'member', `username` VARCHAR(45) NOT NULL, `email` VARCHAR(80) NOT NULL, `pass` VARCHAR(255) NOT NULL, `first_name` VARCHAR(45) NOT NULL, `last_name` VARCHAR(45) NOT NULL, `sex` CHAR(1) NOT NULL, `birth_day` INT NOT NULL, `birth_month` INT NULL, `birth_year` INT NULL, `phone` VARCHAR(20) NULL, `street` VARCHAR(60) NOT NULL, `street_nr` VARCHAR(9) NOT NULL, `city` VARCHAR(45) NOT NULL, `zip_code` VARCHAR(45) NOT NULL, `country` VARCHAR(45) NOT NULL, `user_img` VARCHAR(65) NOT NULL, PRIMARY KEY (`id`), UNIQUE INDEX `username_UNIQUE` (`username` ASC), UNIQUE INDEX `email_UNIQUE` (`email` ASC), INDEX `login` (`email` ASC, `pass` ASC)) ENGINE = InnoDB AUTO_INCREMENT = 4 DEFAULT CHARACTER SET = utf8; | ||||
Tags | No tags attached. | ||||
Operating System | Windows 8 | ||||
PHP Version | 5.5.5-5.5.9 | ||||
|
|
|
Hi, thanks for this report. I investigated, and found that this is not something that Xdebug does wrong, but the MySQLi extension itself. I filed a bug report for PHP at https://bugs.php.net/bug.php?id=67348 |
Date Modified | Username | Field | Change |
---|---|---|---|
2014-05-25 16:39 | bromelio | New Issue | |
2014-05-25 16:39 | bromelio | File Added: affected_rows=1.PNG | |
2014-05-27 22:33 | derick | Note Added: 0002842 | |
2014-05-27 22:33 | derick | Status | new => resolved |
2014-05-27 22:33 | derick | Resolution | open => not fixable |
2014-05-27 22:33 | derick | Assigned To | => derick |
2016-07-31 12:35 | derick | Category | Debug client (console) => debugclient (debugging tool) |
2016-07-31 12:35 | derick | Category | debugclient (debugging tool) => (No Category) |