|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-08-13 19:48 UTC] requinix@php.net
-Summary: PHP Version: 5.4.16
+Summary: class_exists with $autoload=true raising fatal error
[2013-08-13 19:48 UTC] requinix@php.net
[2013-08-13 20:43 UTC] johannes@php.net
-Status: Open
+Status: Feedback
[2013-10-15 11:54 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 10:00:01 2025 UTC |
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)