Edit report at http://bugs.php.net/bug.php?id=53111&edit=1

 ID:                 53111
 Updated by:         johan...@php.net
 Reported by:        gmblar+php at gmail dot com
 Summary:            class_exists call __autoload every time on non
                     existing classes
 Status:             Open
 Type:               Feature/Change Request
 Package:            Performance problem
 Operating System:   Linux
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

That's expected. The autoload function might be non-deterministic.


Previous Comments:
------------------------------------------------------------------------
[2010-10-20 12:10:08] 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)


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53111&edit=1

Reply via email to