Bug #65443 [Fbk->NoF]: class_exists with $autoload=true raising fatal error

From: Date: Tue, 15 Oct 2013 11:54:47 +0000
Subject: Bug #65443 [Fbk->NoF]: class_exists with $autoload=true raising fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182258@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65443&edit=1 ID: 65443 Updated by: php-bugs@lists.php.net Reported by: pieczar92 at interia dot pl Summary: class_exists with $autoload=true raising fatal error -Status: Feedback +Status: No Feedback Type: Bug Package: PHP options/info functions Operating System: Windows 8 PHP Version: 5.4.17 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2013-08-13 19:48:53] requinix@php.net 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#182258) next »