Bug #74515 [Ver]: ini setting for error_reporting not initialized by default
| From: | raat1979 at gmail dot com | Date: | Tue, 02 May 2017 19:29:47 +0000 |
| Subject: | Bug #74515 [Ver]: ini setting for error_reporting not initialized by default | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208916@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74515&edit=1
ID: 74515
User updated by: raat1979 at gmail dot com
Reported by: raat1979 at gmail dot com
Summary: ini setting for error_reporting not initialized by
default
Status: Verified
Type: Bug
Package: *Configuration Issues
Operating System: Ubuntu Linux
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
I have zero experience with the PHP source but perhaps one should check https://github.com/php/php-src/blob/master/Zend/zend.c
at +/- line 148
ZEND_INI_BEGIN()
- ZEND_INI_ENTRY("error_reporting",NULL,ZEND_INI_ALL,OnUpdateErrorReporting)
+ ZEND_INI_ENTRY("error_reporting",E_ALL & ~E_NOTICE & ~E_STRICT &
~E_DEPRECATED,ZEND_INI_ALL,OnUpdateErrorReporting)
Perhaps this would fix it ?
Best would be to define a constant like E_DEFAULT so it can be referenced where needed (see also
static ZEND_INI_MH(OnUpdateErrorReporting) around line 88 for constant usage)
Previous Comments:
------------------------------------------------------------------------
[2017-05-01 19:18:46] raat1979 at gmail dot com
It get's even more weird if we check ini_get_all()
<?php
print_r(ini_get_all()['error_reporting']);
error_reporting(error_reporting());
print_r(ini_get_all()['error_reporting']);
?>
outputs:
Array
(
[global_value] =>
[local_value] =>
[access] => 7
)
Array
(
[global_value] => 22519
[local_value] => 22519
[access] => 7
)
------------------------------------------------------------------------
[2017-04-30 09:51:02] raat1979 at gmail dot com
Description:
------------
If no error_reporting is defined ( not in php.ini, not in .htaccess, not in source)
then ini_get('error_reporting') returns an empty string.
however, error_reporting() does return a value ("22519" on 7.1.4)
in addition phpinfo() shows
master value: "no value"
local Value: "22519"
after setting error_reporting to the current error_reporting() value
the ini value is suddenly set
Test script:
---------------
<?php
echo "<pre>";
var_dump(ini_get('error_reporting'));
var_dump(error_reporting());
error_reporting(error_reporting());
var_dump(ini_get('error_reporting'));
var_dump(error_reporting());
Expected result:
----------------
/var/www/127.0.0.1/index.php:4:string '22519' (length=5)
/var/www/127.0.0.1/index.php:5:int 22519
/var/www/127.0.0.1/index.php:8:string '22519' (length=5)
/var/www/127.0.0.1/index.php:9:int 22519
Actual result:
--------------
/var/www/127.0.0.1/index.php:4:string '' (length=0)
/var/www/127.0.0.1/index.php:5:int 22519
/var/www/127.0.0.1/index.php:8:string '22519' (length=5)
/var/www/127.0.0.1/index.php:9:int 22519
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74515&edit=1