php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Your comment was added to the bug successfully.
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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Tue Oct 15 03:01:28 2019 UTC