dongrouyuan5685 2015-02-08 16:33
浏览 24

'class_exists'创建无限循环

The following code is creating an infinite loop:

$app->OBJ = (object) array(
        // SYSTEM OBJECTS
        'SCOPE'     => TRUE,
        'URI'       => TRUE,
        'Log'       => FALSE,
        // APPLICATION OBJECTS
        'User'      => TRUE,
        'Email'     => TRUE,
        'Files'     => TRUE,
    );

foreach ($app->OBJ as $obj => $bool) {
    if($bool){
        if(!class_exists($obj)) exit('Internal Error: Class \''.$obj.'\' not found.');
        ${strtoupper($obj)} = new $obj();
    }
}

But if I comment this line the loop stops:

// ${strtoupper($obj)} = new $obj();

All my class files are loaded, why is class_exists creating an infinite loop?

  • 写回答

0条回答 默认 最新

    报告相同问题?