[php-src] Issue #24112: Improve the reporting of parsing errors
| From: | David263 | Date: | Sun, 04 Oct 2026 09:46:00 +0000 |
| Subject: | [php-src] Issue #24112: Improve the reporting of parsing errors | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-252895@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/24112
Author: David263
### Description
(I'm posting here to capture this idea, as I don't have the time to shepherd the steps of
a formal RFC request.)
Currently, a parse error is reported to an error file and an HTTP 500 error is raised by all recent
versions of PHP, unless php.ini is changed (which is not always possible, and which might require
distinguishing between production and development access, which is currently not supported except by
workarounds like using an environment variable). Reporting error settings are ignored. There is no
perfect workaround available via .htaccess under Apache. There is a workaround: changing all main
programs to include/require the real main programs, but this is arguably ugly and adds to the
learning hurdle.
These problems could be solved by a rewrite of the parser and how the parser is called, so it works
like many other interpreters or compilers.
It could be argued that this is a major change that would impact many users. However, major changes
that impact more users than would be impacted by this change have already been done. An example is
the mysql_* removal (deprecated in 5.5, gone in 7.0). This required rewriting almost all MySQL code,
an incredible impact, justified only by a perceived urgent need to increase security.
And there were other PHP changes that involved deprecation with much, much lower urgency, such as
the $string{0} curly-brace offset syntax being removed in 8.0 after a deprecation period.
Reporting parsing errors in the same way as other errors would benefit far more users than it would
burden, by improving the reporting of this category of error and by reducing the PHP learning hurdle
and several maintenance impacts.