php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81166 "display_errors" php.ini is not normalized when set using ini_set
Submitted: 2021-06-18 09:02 UTC Modified: 2021-06-21 15:31 UTC
From: m at m dot cz Assigned:
Status: Open Package: PHP options/info functions
PHP Version: 8.0.7 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: m at m dot cz
New email:
PHP Version: OS:

 

 [2021-06-18 09:02 UTC] m at m dot cz
Description:
------------
When "display_errors" php.ini option is set before startup (using php.ini ocnfig or "-d" cli option), it is normlaized to "" or "1" (or "stderr").

But when set using ini_set function, it is NOT normalized which makes checking the real value/effect from user script very hard.

https://3v4l.org/cmhV1

Test script:
---------------
ini_set('display_errors', 'off');

var_dump(ini_get('display_errors'));

Expected result:
----------------
string(0) ""

Actual result:
--------------
string(3) "off"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-21 15:31 UTC] cmb@php.net
While this is somewhat inconsistent, there is some overall
consistency here.  On startup, the value is normalized by virtue
of the INI scanner (basically, the same what parse_ini_string()
does), while changes during runtime are processed normally for
string options.

While the behavior wrt. display_errors is not nice, it is worse
for other string options (e.g. error_prepend_string) where the
value `off` during startup is also treated as empty string.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jul 28 12:01:23 2021 UTC