除錯器協議

PHP 3 除錯器協議以行為單位。每一行有一個型別(type),某幾行組成一個消息(message)。每一個消息起始於包含型別 start 的一行,並終止於包含型別 end 的一行。PHP 3 可以同時發送不同的消息行。

行的格式如下:


date time
host(pid)
type:
message-data
     

date

date 使用 ISO 8601 格式: (yyyy-mm-dd)

time

Time 精確到毫秒: hh:mm:uuuuuu

host

產生錯誤的 PHP 腳本所在主機的 DNS 名或 IP 位址。

pid

產生錯誤的 PHP 腳本在 host 中的PID (進程 id)。

type

行的型別。它告訴接收訊息的程序如何處理下面的資料:

表格 D-1. 除錯器行型別

名稱含義
start 告訴接收的程序,除錯訊息由此開始。data 的內容將會是錯誤消息的型別,在本頁面下方列出。
messagePHP 3 錯誤消息。
location 發生錯誤的文件名和行號。location 的第一行總是包含頂級(top-level)位址。data 包含 file:line。在 message 和每一個 function 之後總有一行 location 行。
framesNumber of frames in the following stack dump. If there are four frames, expect information about four levels of called functions. If no "frames" line is given, the depth should be assumed to be 0 (the error occurred at top-level).(TODO)
function 發生錯誤的函式。在呼叫函式堆棧的每級只重複一次。
end 告訴接收的程序,除錯訊息到此結束。

data

每行的資料。

表格 D-2. 除錯器錯誤型別

除錯器PHP 3 內部
warningE_WARNING
errorE_ERROR
parseE_PARSE
noticeE_NOTICE
core-errorE_CORE_ERROR
core-warningE_CORE_WARNING
unknown(其它任何錯誤)

例子 D-1. 除錯器錯誤消息示例


1998-04-05 23:27:400966 lucifer.guardian.no(20481) start: notice
1998-04-05 23:27:400966 lucifer.guardian.no(20481) message: Uninitialized variable
1998-04-05 23:27:400966 lucifer.guardian.no(20481) location: (NULL):7
1998-04-05 23:27:400966 lucifer.guardian.no(20481) frames: 1
1998-04-05 23:27:400966 lucifer.guardian.no(20481) function: display
1998-04-05 23:27:400966 lucifer.guardian.no(20481) location: /home/ssb/public_html/test.php3:10
1998-04-05 23:27:400966 lucifer.guardian.no(20481) end: notice