关闭语句后的mysqli + xdebug断点导致许多警告 [英] mysqli + xdebug breakpoint after closing statement result in many warnings

查看:71
本文介绍了关闭语句后的mysqli + xdebug断点导致许多警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段这样的代码:

$conn = new mysqli($host, $username, $passwd, $dbname);

...

$stmt = $conn->prepare('SELECT ...');
$stmt->bind_param(...);
$stmt->execute();
$stmt->bind_result(...);
while($stmt->fetch())
{
    // do something here
}
$stmt->close();

...

// do something more here that has absolutely nothing to do with $stmt

这很好用.我得到了预期的结果,没有任何错误或任何不应该发生的事情.

This works perfectly fine. I get the results I expected, there are no errors or anything that is not supposed to happen.

但是如果我设置一个断点(Xdebug 2.2.5/2.2.6/2.2.8/2.3.2和PHP 5.5.3/5.5.15/5.6.0/5.6.6/5.6.10)在之后 $stmt->close();的一行,我收到许多警告,例如

But if I set a break point (Xdebug 2.2.5 / 2.2.6 / 2.2.8 / 2.3.2 and PHP 5.5.3 / 5.5.15 / 5.6.0 / 5.6.6 / 5.6.10) to a line after $stmt->close();, I get many warnings like

还不允许访问财产

Property access is not allowed yet

无法获取mysqli_stmt

Couldn't fetch mysqli_stmt

我以为我错过了关闭另一个mysqli语句的机会,但是我得到了所有结果.我的代码似乎没有问题...

I thought I missed to close another mysqli statement, but I get all results. There seems to be just no problem in my code...

有办法摆脱这种错误的警告吗?

Is there a way to get rid of this wrong warnings?

更新:此问题在PHP 7.0.1/Xdebug 2.4.0 RC3中仍然存在.

Update: This problem still exist in PHP 7.0.1 / Xdebug 2.4.0 RC3.

推荐答案

报告了一些类似的问题
http://bugs.xdebug.org/view.php?id=900
https://bugs.php.net/bug.php?id=60778

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);

按照评论中@Martin的说明关闭连接后.

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.

编辑:现在还有一个已报告的问题:)

编辑:此处.

编辑:如果您使用PDO,似乎不会出现此错误.因此,这也许是切换到PDO的另一个原因.

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

这篇关于关闭语句后的mysqli + xdebug断点导致许多警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆