2013-06-05 66 views
0

使用Eclipse/xdebug n Windows 2008服务器。昨天我能够成功调试一个php文件。今天,一个非常类似的php文件,它跳过了线条,然后就被遗忘了。 代码片段:xdebug在调试时跳过了行

//$data = file_get_contents('php://input'); 
$data = '[{"ARDivisionNo":"01","CustomerNo":"ABF","ContactCode":"ARTIE JOHN","CustomerName":"American Business Futures","fname":"Artie ","lname":"Johnson","EmailAddress":"[email protected]","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在变量窗口中显示为空。 有什么错误/如何解决的任何想法?

回答

2

很可能Xdebug看起来是一个不同于源代码的文件。你确定你在开始调试之前先保存了文件?

有几种情况,Xdebug做跳行,因为它没有看到任何断点。这是因为PHP本身并不总是给出这种可能性。它通常在没有{和}的if/else语句上。为了找出到底是怎么回事,你可以通过添加为php.ini进行远程调试日志:

xdebug.remote_log=/tmp/xdebug.log 

的Xdebug会写所有的通信数据包中该日志为你去看看。也许这提供了一个线索。