getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
634 stars 95 forks source link

Error Suppresion causes difficulty debugging #152

Open designforhumans opened 7 years ago

designforhumans commented 7 years ago

I created a new folder (named 'Tools') for some extraneous custom classes at /wp-content/plugins/herbert/app/

When I moved this plugin to a new environment, the plugin caused my site to white screen with no error messages posted to screen. I had to spend around 3 hours painfully going through plugins and files eventually finding out that the file at /plugins/herbert/vendor/getherbert/framework/Herbert/Framework/Application.php has many instances of using require or require_once with preceding @ to suppress errors.

The plugin does some kind of file pre-loading / caching, and it was @require'ing my files , for some reason using the lowercase version of the folder name e.g. /tools/file1.php - instead of Tools/file1.php as the required file did not exist it then throws a silent fatal error.

Please fix this. 1) Don't use error suppression. 2) Why does your preloader function modify the filepath?

designforhumans commented 7 years ago

I fixed this by hardcoding $require = str_replace('tools', 'Tools', $require); on line 316 of /plugins/herbert/vendor/getherbert/framework/Herbert/Framework/Application.php a clumsy hack for sure, but it was 3am... a better solution is much needed.