php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80562 set_error_handler does not handle the warning about "private final function"
Submitted: 2020-12-29 21:41 UTC Modified: 2020-12-29 21:55 UTC
From: the dot is dot medvedev at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 8.0.0 OS: Docker php:8.0.0-cli
Private report: No CVE-ID: None
 [2020-12-29 21:41 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-29 21:52 UTC] the dot is dot medvedev at gmail dot com
-Summary: set_error_handler does not handle the warning "Private methods cannot be..." +Summary: set_error_handler does not handle the warning about "private final function"
 [2020-12-29 21:52 UTC] the dot is dot medvedev at gmail dot com
Change the summary
 [2020-12-29 21:55 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2020-12-29 21:55 UTC] requinix@php.net
That warning is an E_COMPILE_WARNING, which cannot be caught by an error handler.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC