php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73665 set_error_handler cant't listen E_Deprecated when opcache loaded
Submitted: 2016-12-06 09:36 UTC Modified: 2017-02-19 10:41 UTC
From: lcx165 at gmail dot com Assigned:
Status: Verified Package: opcache
PHP Version: 7.0.13 OS: Linux 64bit NTS
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lcx165 at gmail dot com
New email:
PHP Version: OS:

 

 [2016-12-06 09:36 UTC] lcx165 at gmail dot com
Description:
------------
When opcache.so loaded,use set_error_handler function listen all error.
When E_Deprecated happened, can't call error_handler function, use php system error display.

Test script:
---------------
//a.php
<?php

class A {
    //E_Deprecated 
    function a() {

    }   
}


//error.php
<?php

error_reporting(E_ALL);

set_error_handler(function($code, $msg, $file, $line) {
	echo  "[{$code}] {$msg}\r\n";
});

//NOTICE
echo $a;

//E_Deprecated 
include 'a.php';

//run as cli: php error.php

Expected result:
----------------
[8] Undefined variable: a
PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in /root/a.php on line 3

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in /root/a.php on line 3


Actual result:
--------------
[8] Undefined variable: a
[8192] Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-19 10:41 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2017-02-19 10:42 UTC] cmb@php.net
The expected and actual results above are swapped, but otherwise I can reproduce this at least for the first page request.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 20:01:30 2019 UTC