Bug #52762 [Opn->Csd]: autoload not called inside create_function
| From: | nikic@php.net | Date: | Fri, 19 Feb 2016 12:28:22 +0000 |
| Subject: | Bug #52762 [Opn->Csd]: autoload not called inside create_function | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199337@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52762&edit=1
ID: 52762
Updated by: nikic@php.net
Reported by: morpika at vipmail dot hu
Summary: autoload not called inside create_function
-Status: Open
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: FreeBSD 8.0
PHP Version: 5.3.3
-Assigned To:
+Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
This has been fixed in PHP 5.4.21, PHP 5.5.5 and higher: https://3v4l.org/sTbmb
Previous Comments:
------------------------------------------------------------------------
[2010-10-10 15:24:29] jeanseb at au-fil-du dot net
Reproduce on PHP 5.2.6 & 5.2.12
------------------------------------------------------------------------
[2010-09-01 18:56:16] morpika at vipmail dot hu
Description:
------------
If i define my own error handler with the use of the set_error_handler and the create_function
functions, then the 'errors' class inside the create_function triggers the autoload
function by errors that user defined error handlers can handle. It's OK!
But when i make an E_STRICT error for example by defining the 'connect' function in class
'a' (which already exists in the built in mysqli class), then it won't call the
autoload function, it gives me a fatal error for not finding the 'errors' class.
What i expected:
a) If this type of E_STRICT error cann't be handled by my own error handler, then PHP's
default error handler should have been used.
b) If this type of E_STRICT error can be handled by my own error handler, then the __autoload
function should have been called as a last chance for opening the 'errors' class.
Test script:
---------------
index.php:
<?php
set_error_handler(create_function('', 'errors::php_error();'));
function __autoload($class_name) { die('autoload called'); }
include('mysql.php');
?>
mysql.php:
<?php
class a extends mysqli {
function connect() {}
}
?>
Expected result:
----------------
autoload called
Actual result:
--------------
Fatal error: Class 'errors' not found in mysql.php on line 7
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=52762&edit=1