php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53111 class_exists call __autoload every time on non existing classes
Submitted: 2010-10-20 12:10 UTC Modified: 2010-10-21 11:55 UTC
From: gmblar+php at gmail dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
10 + 49 = ?
Subscribe to this entry?

 
 [2010-10-20 12:10 UTC] gmblar+php at gmail dot com
Description:
------------
class_exists call __autoload every time on non existing classes

Test script:
---------------
<?php

header('Content-Type: text/plain');

function __autoload($class) {
    var_dump('Autoload '.$class);
}

for($a=0; $a<10; $a++) {
    $status = class_exists('foobar');
    var_dump($status);
}

?>

Expected result:
----------------
string(15) "Autoload foobar"
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)
bool(false)

Actual result:
--------------
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)
string(15) "Autoload foobar"
bool(false)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-21 11:51 UTC] johannes@php.net
That's expected. The autoload function might be non-deterministic.
 [2010-10-21 11:55 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-10-21 11:55 UTC] johannes@php.net
.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC