Bug #81166 [Opn]: "display_errors" php.ini is not normalized when set using ini_set

From: Date: Tue, 12 Oct 2021 12:51:39 +0000
Subject: Bug #81166 [Opn]: "display_errors" php.ini is not normalized when set using ini_set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237160@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81166&edit=1

 ID:                 81166
 Updated by:         cmb@php.net
 Reported by:        m at m dot cz
 Summary:            "display_errors" php.ini is not normalized when set
                     using ini_set
 Status:             Open
 Type:               Bug
 Package:            PHP options/info functions
 Operating System:   any
 PHP Version:        8.0.7
 Block user comment: N
 Private report:     N

 New Comment:

Related to bug #52168.


Previous Comments:
------------------------------------------------------------------------
[2021-06-21 15:31:58] 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-06-18 09:02:22] 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"


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81166&edit=1


Thread (3 messages)

« previous php.bugs (#237160) next »