【问题标题】:xdebug is skipping lines while debuggingxdebug 在调试时跳过行
【发布时间】:2013-06-01 16:18:27
【问题描述】:

使用 Eclipse/xdebug n Windows 2008 服务器。昨天我能够成功调试一个 php 文件。今天,使用一个非常相似的 php 文件,它正在跳过行然后被遗忘。 代码sn-p:

//$data = file_get_contents('php://input');
$data = '[{"ARDivisionNo":"01","CustomerNo":"ABF","ContactCode":"ARTIE   JOHN","CustomerName":"American Business Futures","fname":"Artie ","lname":"Johnson","EmailAddress":"philmcintosh@comcast.net","Billing_Address1":"2131 N. 14th Street","Billing_Address2":"Suite 105","Billing_Address3":"Accounting Department","Billing_City":"Irvine","Billing_State":"CA","Billing_Zip":"92618","UDF_FC_ENABLED":"Y","UDF_FC_CUSTOMERID":2.0,"UDF_FC_ADDRESS_BOOK_ID":3.0,"TelephoneNo1":"","FaxNo":""}]'; 
$json = json_decode($data, true);

Foreach ($json as $i => $row) {
    $customers_id = tep_db_prepare_input($row['UDF_FC_CUSTOMERID']);
    $customers_firstname = tep_db_prepare_input($row['fname']);

(出于调试目的,我粘贴了 json - 这昨天在另一个文件中有效。) 在这个文件中,第一个奇怪的事情是调试器实际上停止在注释掉的“$data = file_get_contents('php://input');”线。 在下一个“$data =”行之后,它跳到“$customers_id =”行。此时 $data 在变量窗口中显示为空。 关于什么是错误的/如何解决的任何想法?

【问题讨论】:

    标签: php eclipse debugging xdebug


    【解决方案1】:

    Xdebug 可能看起来与您所看到的源代码文件不同。您确定在开始调试之前先保存了文件吗?

    在某些情况下,Xdebug 会跳过行,因为它没有看到任何断点。这是因为 PHP 本身并不总是提供这种可能性。它通常只出现在没有 { 和 } 的 if/else 语句中。为了搞清楚是怎么回事,可以在php.ini中添加远程调试日志:

    xdebug.remote_log=/tmp/xdebug.log
    

    Xdebug 会将所有通信数据包写入此日志供您查看。也许这提供了一个线索。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-23
      • 2013-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多