White screen, not instantiating

See all posts Reply

White screen, not instantiating new!
by Paul R. De Buck, 4 years, 1 month ago
Hello,

I've used your class, which is specially great.
But I came across a problem, whenever I instantiated the class (without doing anything else at all) :

$handle = new upload($_FILES['easy_file']);

I got a blank screen, so I supposed it came from the source file.
I finally tracked it down to this specific line:

Line 2401
} elseif (@class_exists('finfo')) {

If you remove the @, it will show an error.
In my case

Warning: require(D:\Sites\Newsletter\application\model/finfo.php): failed to open stream: No such file or directory in D:\Sites\Newsletter\application\core\controller.php on line 49

And I finally found why, I had a spl_autoload_register for my classes.
In this case it was trying to open finfo() and load it from my OWN classes.
But this is a PHP class.

So you just need to change that line to:

Line 2401:
} elseif (class_exists('finfo', false)) {

Notice the second parameter, by setting it to false, it will NOT try to use the autoloader. And so load the PHP own class.

After an hour of looking for this solution I'm sharing it here, so some other might find a solution, and maybe update the code to reflect this little bug.

Thank you very much for your time and this beautiful class Verot.net !Reply
Re: White screen, not instantiating new!
by colin, 4 years, 1 month ago
Thank you!Reply