Bug #73665 [NEW]: set_error_handler cant't listen E_Deprecated when opcache loaded

From: Date: Tue, 06 Dec 2016 09:36:06 +0000
Subject: Bug #73665 [NEW]: set_error_handler cant't listen E_Deprecated when opcache loaded
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205801@lists.php.net to get a copy of this message
From:             lcx165 at gmail dot com
Operating system: Linux 64bit NTS
PHP version:      7.0.13
Package:          opcache
Bug Type:         Bug
Bug description:set_error_handler cant't listen E_Deprecated when opcache loaded

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

-- 
Edit bug report at https://bugs.php.net/bug.php?id=73665&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=73665&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=73665&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=73665&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=73665&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=73665&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=73665&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=73665&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=73665&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=73665&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=73665&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=73665&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=73665&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=73665&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73665&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=73665&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=73665&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=73665&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73665&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=73665&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=73665&r=mysqlcfg



Thread (7 messages)

« previous php.bugs (#205801) next »