Doc #75924 [Com]: No doc: behavior of @ini_get('error_reporting') was changed from 5.6 to 7.0
[email protected] ("bloogersitelist at gmail dot com") Mon, 19 Jun 2023 10:42:10 +0000
| Newsgroups | php.doc.bugs |
|---|---|
| Message-ID | <[email protected]> |
Edit report at https://bugs.php.net/bug.php?id=75924&edit=1
ID: 75924
Comment by: bloogersitelist at gmail dot com
Reported by: mikko dot rantalainen at peda dot net
Summary: No doc: behavior of @ini_get('error_reporting') was
changed from 5.6 to 7.0
Status: Open
Type: Documentation Problem
Package: Scripting Engine problem
Operating System: Linux/Ubuntu
PHP Version: 7.2.2
Block user comment: N
Private report: N
New Comment:
Floor Decorate News are sharing latest news about about floor, decorate, design,estate etc. More info to visit: (https://floordecoratenews.com)github.com
Previous Comments:
------------------------------------------------------------------------
[2018-02-06 13:36:33] [email protected]
The @ is not being ignored. Rather, (as I remember it) when @ suppresses error reporting it no longer affects the INI setting. ini_get() will properly report what the setting is, not the temporary value established during the expression evaluation. What I don't know/remember is whether this is tied to a bug report (couldn't find one) or one of 7.0's many other changes (AST?).
Since the behavior is from the @ I think noting the change is best suited for that doc page.
http://php.net/manual/en/language.operators.errorcontrol.php
------------------------------------------------------------------------
[2018-02-06 12:56:43] mikko dot rantalainen at peda dot net
Description:
------------
---
From manual page: http://www.php.net/function.error-reporting
---
The ini_get('error_reporting') was historically the only way to get same results as current implementation of error_reporting(). However, the behavior
of ini_get('error_reporting') was changed between PHP 5.6 and 7.0 but this has not been documented anywhere.
See https://3v4l.org/3lFoe for demo.
Note that this also affect all custom error handlers that inspect value of ini_get('error_reporting') and not just @ini_get() syntax.
I assume that PHP 7.x ignores at-sign by design (the function name suggests that this is the value set in the ini file) but this change is missing official documentation.
I'd prefer this to be documented in both http://www.php.net/function.error-reporting and http://php.net/manual/en/function.ini-get.php
Test script:
---------------
<?php
# different results for PHP 5.x and 7.x:
ini_set('error_reporting', 1);
$a = array();
$a['ini_get'] = ini_get('error_reporting');
$a['error_reporting'] = error_reporting();
$a['@ini_get'] = @ini_get('error_reporting');
$a['@error_reporting'] = @error_reporting();
var_export($a);
Expected result:
----------------
The output should be stable for all versions.
Actual result:
--------------
Behavior is stable for 5.x and all versions of hhvm. However, PHP 7.x will ignore the at-sign (@) in front of ini_get(). I believe that PHP 4.x used to work identical to 5.x here but I do not have any environment to test that.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75924&edit=1