Edit report at https://bugs.php.net/bug.php?id=65443&edit=1
ID: 65443 Updated by: requi...@php.net Reported by: pieczar92 at interia dot pl -Summary: PHP Version: 5.4.16 +Summary: class_exists with $autoload=true raising fatal error Status: Open Type: Bug Package: PHP options/info functions Operating System: Windows 8 PHP Version: 5.4.17 Block user comment: N Private report: N New Comment: Ticket renamed. Test scripts need to be stand-alone and executable with a simple copy and paste on our part. What you've posted requires a $gravatarURL and, to reproduce your results, an autoloader. You are using an autoloader, correct? Yours is deriving a filename and immediately require or require_once-ing it. That is incorrect: it must check if the file even exists first. Make that change to your autoloader and use $autoload=true in your call to class_exists(). If that does not fix the problem then please post a COMPLETE test script that can be run by itself without using any undefined variables or external autoloaders. Previous Comments: ------------------------------------------------------------------------ [2013-08-13 19:02:15] pieczar92 at interia dot pl Description: ------------ Welcome. My report is related to the function: bool class_exists (string $ class_name [, bool $ autoload = true]) Namely, I have noticed that if the result of the function returns false, the script crashes mistake, because after all, the script tries to load a non- existent class. Problem solved by changing the parameter $ autoload to false. I believe that the $ autoload should be taken into account only if the result of the function will amount to true. I'm sorry for syntax errors. My text was translated Google tools - translation. Regards, Kamil Piechaczek Test script: --------------- if( class_exists('finfo', false) ) { $fInfo = new finfo(FILEINFO_MIME); $gravatarImageMime = $fInfo->file($gravatarURL, FILEINFO_MIME_TYPE); } else { $gravatarImage = getimagesize($gravatarURL); $gravatarImageMime = $gravatarImage['mime']; } Expected result: ---------------- Variable $gravatarImageMime should has type mime of file. Actual result: -------------- White screen (autoload can't find file) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65443&edit=1