php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32066 display_errors=off also suppresses output from php -l
Submitted: 2005-02-22 16:07 UTC Modified: 2005-03-14 14:55 UTC
From: marcus at synchromedia dot co dot uk Assigned:
Status: Not a bug Package: PHP options/info functions
PHP Version: 5.0.3 OS: RedHat Enterprise Linux 3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marcus at synchromedia dot co dot uk
New email:
PHP Version: OS:

 

 [2005-02-22 16:07 UTC] marcus at synchromedia dot co dot uk
Description:
------------
In php5, if php.ini contains a display_errors=off 
directive, it also suppresses error details from 'php 
-l' on a command line. I guess this could be a 
deliberate change in pHP5, but it is really not very 
helpful as php -l will only ever be run by developers.

This is in contrast to php4, which always shows errors 
from php -l, even if display_errors is off.

Reproduce code:
---------------
execute this script (containing a deliberate error) using php -l on a command line with display_errors turned off

<?php
print trim('hello';
?>

Expected result:
----------------
Parse error: parse error, unexpected ';' in /home/
username/error.php on line 2

Actual result:
--------------
no output is generated at all.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-23 19:32 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Error display ini setting affects all error reporting.
 [2005-03-14 14:55 UTC] marcus at synchromedia dot co dot uk
You say:

> Error display ini setting affects all error reporting.

That's just not true. It may be that the behaviour has 
changed in PHP5 (in which case it should be documented 
here: http://www.php.net/manual/en/
ref.errorfunc.php#ini.display-errors), 
but in PHP4 having display_errors=off does NOT suppress 
error messages from php -l. It's very easy to reproduce 
in PHP4: 
The output from 'php -i|grep display_errors' is:

display_errors => Off => Off

and yet php -l on the example I gave produces:

PHP Parse error:  parse error, unexpected ';' in 
test.php on line 2
Errors parsing test.php

Under PHP5 it does NOT work this way - the behaviour HAS 
changed to the behaviour you said.

If what you said is MEANT to be true, then this bug 
should be closed, rephrased as 'display_errors=off does 
not 
suppress output from php -l' and re-reported as a PHP4 
bug - it's got to be a bug one way or the other. 
Personally I'd like php-l to ignore the display_errors 
setting, just as it does in PHP4, which is why I 
reported the discrepancy in the first place.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC