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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Thu Jan 23 22:01:25 2020 UTC