php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80191 Deprecated example
Submitted: 2020-10-06 11:21 UTC Modified: 2020-10-06 11:52 UTC
From: Kreweta0 at op dot pl Assigned: cmb (profile)
Status: Closed Package: *General Issues
PHP Version: 7.4.11 OS: n/a
Private report: No CVE-ID: None
 [2020-10-06 11:21 UTC] Kreweta0 at op dot pl
Description:
------------
In the PHP manual on page https://www.php.net/manual/en/language.operators.errorcontrol.php the first example has an expression that uses the $php_errormsg variable, as shown below.

$my_file = @file ('non_existent_file') or
    die ("Failed opening file: error was '$php_errormsg'");

The manual does say that this $php_errormsg variable is set only if "track_errors" feature is enabled. However, I found out that it is actually a deprecated feature now. I was slightly confused when I got an error -- Undefined variable: php_errormsg -- when the example teaches me how to ignore errors.

I think that another example might serve as a better introduction to the '@' operator, while this existing one can be shown later as a relic of the past the reader might see around.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-10-06 11:52 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=3e0354fcfc15160a9cfae43f56966f0fbcbc5cd9
Log: Fix #80191: Deprecated example
 [2020-10-06 11:52 UTC] phpdocbot@php.net
-Status: Open +Status: Closed
 [2020-10-06 11:52 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2020-10-06 21:15 UTC] phpdocbot@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=0c264adebe70e1f2762703814de1209284c95e3e
Log: Fix #80191: Deprecated example
 [2020-12-30 11:58 UTC] nikic@php.net
Automatic comment on behalf of mumumu
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=3fce5cd5449d4d36650796a9a1792d14490850b7
Log: Fix #80191: Deprecated example
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 16 12:01:32 2024 UTC