Req #61455 [Opn->Fbk]: Warn when ini_set()'ing certain directives
| From: | cmb@php.net | Date: | Tue, 16 Mar 2021 14:54:29 +0000 |
| Subject: | Req #61455 [Opn->Fbk]: Warn when ini_set()'ing certain directives | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232785@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61455&edit=1
ID: 61455
Updated by: cmb@php.net
Reported by: brad at njoe dot com
Summary: Warn when ini_set()'ing certain directives
-Status: Open
+Status: Feedback
Type: Feature/Change Request
Package: PHP options/info functions
Operating System: N/A
PHP Version: 5.3.10
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
ini_set() returns false if the directive could not be changed[1];
isn't checking the return value sufficient?
[1] <https://3v4l.org/hvRAg>
Previous Comments:
------------------------------------------------------------------------
[2012-03-20 14:01:33] brad at njoe dot com
Errata #1 - Looks like PHP is intelligent enough to report the unchanged values
for such directives when doing a phpinfo() (e.g. you can't ini_set() the
'allow_url_fopen' directive and see the "Local Value" change on the phpinfo()
page).
Thus, the "don't quietly allow directives to be changed" above should probably
have been "don't quietly accept requests to change directives" or something of the
sort.
------------------------------------------------------------------------
[2012-03-20 13:56:55] brad at njoe dot com
Description:
------------
If ini_set() is called to set any PHP directive whose 'Changeable' attribute (e.g.
as per man page http://php.net/ini.list) is not
'PHP_INI_USER' or 'PHP_INI_ALL',
an error message could be generated to advise the developer that the statement
will have no effect. In other words, don't quietly allow directives to be changed
when they've already taken effect by the time the script is executed (thus
changing them via ini_set() won't ever do anything).
Test script:
---------------
<?php
ini_set('allow_url_fopen', '1');
Expected result:
----------------
Warning: Changing PHP directive at runtime has no effect in <code> on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61455&edit=1