php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52762 autoload not called inside create_function
Submitted: 2010-09-01 18:56 UTC Modified: 2016-02-19 12:28 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: morpika at vipmail dot hu Assigned: nikic (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3.3 OS: FreeBSD 8.0
Private report: No CVE-ID: None
 [2010-09-01 18:56 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-10 15:24 UTC] jeanseb at au-fil-du dot net
Reproduce on PHP 5.2.6 & 5.2.12
 [2011-11-15 18:08 UTC] felipe@php.net
-Package: *Programming Data Structures +Package: Scripting Engine problem
 [2016-02-19 12:28 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2016-02-19 12:28 UTC] nikic@php.net
This has been fixed in PHP 5.4.21, PHP 5.5.5 and higher: https://3v4l.org/sTbmb
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 23:00:02 2025 UTC