php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78532 error control operator not behaving the same as php5
Submitted: 2019-09-13 12:12 UTC Modified: 2019-09-13 12:25 UTC
From: jcmargentina at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 7.1.32 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jcmargentina at gmail dot com
New email:
PHP Version: OS:

 

 [2019-09-13 12:12 UTC] jcmargentina at gmail dot com
Description:
------------
I noticed that the Error Control Operator is behaving different in php7 than php5

Test script:
---------------
<?php

function query()
{
    $myrs = null;
    $tmp = @$myrs->free_result();

    return $tmp;
}

var_dump(query());

echo "Another output";

Expected result:
----------------
NOTHING (as of php5)

Actual result:
--------------
Fatal error:  Uncaught Error: Call to a member function free_result() on null in [...][...]:6
Stack trace:
#0 [...][...](11): query()
#1 {main}
  thrown in [...][...] on line 6

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-13 12:18 UTC] bugreports at gmail dot com
a fatal error always halts the script and it won't make sense to supress the error leading to a white page
 [2019-09-13 12:25 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2019-09-13 12:25 UTC] nikic@php.net
This is an intentional change caused by switch from fatal errors to exceptions. Not that in PHP 8, @ will no longer suppress fatal errors either.
 [2019-09-13 12:37 UTC] jcmargentina at gmail dot com
Thanks very much for this, I did not find something related to this anywere, now is documented
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC