所有可能的PHP错误列表 [英] List of all the possible PHP errors

查看:77
本文介绍了所有可能的PHP错误列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,在用PHP编码时,我们会遇到如下解析或语法错误:

Sometimes, while coding in PHP we get parse or syntax errors like those:

Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in /var/www/example/index.php on line 4

我想知道,是否有PHP解释器可以输出的所有可能错误的列表.我已经搜索了php.net,但是找不到这样的东西.我出于学术目的需要这份清单.

I would like to know, if there is a list of all possible errors that PHP interpreter can output. I've searched php.net, but couldn't find such thing. I need this list for academic purposes.

推荐答案

没有没有好的方法.即使是针对zend_Error()的建议grep也无济于事.您在问题中显示的那种错误大部分是由bison解析器生成器生成的,PHP只是从那里获取错误.操作系统报告的错误(例如打开文件时的错误)也会发生类似的情况. PHP开发人员不能真正为这些列表生成一个好的列表,因为错误取决于它所运行的操作系统以及编译时使用的版本.

No there is no good way. Even the suggested grep for zend_Error() is useless. The errors of the kind you're showing in the question is mostly generated by the bison parser generator and PHP simply takes it from there. Similar things happen with errors reported by the operating system (like errors when opening files). The PHP developers can't really generate a good list for these as the errors depend on the operating system it is running on and versions used while compiling.

gendping zend_error()和php_Error_docref()唯一可以显示的是对可能的错误类型的概述,但到目前为止,并不是所有错误消息.

The only thing grepping for zend_error() and php_Error_docref() can show you is a general overview of possible error kinds but by far not all error messages.

这篇关于所有可能的PHP错误列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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