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-10-12 12:51 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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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.
 [2021-10-12 12:51 UTC] cmb@php.net
Related to bug #52168.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 19:05:44 2022 UTC