Bug #80562 [Opn->Nab]: set_error_handler does not handle the warning about "private final function"
| From: | requinix@php.net | Date: | Tue, 29 Dec 2020 21:55:18 +0000 |
| Subject: | Bug #80562 [Opn->Nab]: set_error_handler does not handle the warning about "private final function" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-231303@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80562&edit=1
ID: 80562
Updated by: requinix@php.net
Reported by: the dot is dot medvedev at gmail dot com
Summary: set_error_handler does not handle the warning about
"private final function"
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Docker php:8.0.0-cli
PHP Version: 8.0.0
Block user comment: N
Private report: N
New Comment:
That warning is an E_COMPILE_WARNING, which cannot be caught by an error handler.
Previous Comments:
------------------------------------------------------------------------
[2020-12-29 21:52:40] the dot is dot medvedev at gmail dot com
Change the summary
------------------------------------------------------------------------
[2020-12-29 21:41:51] the dot is dot medvedev at gmail dot com
Description:
------------
Running by docker inside the folder with index.php and Foo.php files:
sudo docker run -it --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp php:8.0.0-cli php
index.php
Test script:
---------------
// index.php
<?php
set_error_handler(function ($errno, $errstr) {
echo "Handler -> $errno, $errstr\n";
return true;
});
// Checking the handler
gettype($a);
include 'Foo.php';
// Foo.php
<?php
class Foo {
private final static function bar () {
}
}
Expected result:
----------------
Handler -> Undefined variable $a
Handler -> Private methods cannot be final as they are never overridden by other classes
Actual result:
--------------
Handler -> Undefined variable $a
Warning: Private methods cannot be final as they are never overridden by other classes in
/usr/src/myapp/Foo.php on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80562&edit=1