mysqli + xdebug breakpoint after closing statement result in many warnings

/* PHP 7.0.5 - MYSQLi (mysqlnd 5.0.12-dev)  - XDEBUG 2.4 */
/* This one will allow breakpoints before / after / step through */

if (function_exists('xdebug_disable'))
              {
               $errorlevel=error_reporting();
               $displayerrors=ini_get('display_errors');
               ini_set('display_errors',0);
                error_reporting(0);
                xdebug_disable();
              }

                mysqli_close($DATA_DBH);
               unset($DATA_DBH);
      if (function_exists('xdebug_enable'))
              {
                xdebug_enable();
                error_reporting($errorlevel);
               ini_set('display_errors',$displayerrors);
              }

FWIW, this was a bug in PHP (https://bugs.php.net/bug.php?id=67348&edit=1), which should be fixed for PHP 7.4: https://github.com/php/php-src/commit/579562176b71820ad49d43b2c841642fef12fe57


There are some similar issues reported
http://bugs.xdebug.org/view.php?id=900
https://bugs.php.net/bug.php?id=60778

One way to get rid of this messages is to add

unset($stmt);

after closing the statement and before the breakpoint. If this does not help, you should also add

unset($connection);

after closing the connection as mentioned by @Martin in the comments.

This does not solve the problem itself, but let you go on with your work until this may be fixed some time.

EDIT: Now there is also a reported issue :)

EDIT: This seems to be a bug in the MySQLi driver as reported here.

EDIT: Looks like this bug does not appear if you use PDO. So this is maybe an other reason to switch to PDO.

Tags:

Php

Xdebug

Mysqli