Skip to content

Commit

Permalink
Soft fail on missing plugin file. See: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
JasWSInc committed Nov 20, 2014
1 parent edfe306 commit d501814
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion quick-cache/includes/advanced-cache.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@
/*
* Include shared methods between {@link advanced_cache} and {@link plugin}.
*/
require_once dirname(QUICK_CACHE_PLUGIN_FILE).'/includes/share.php';
if(defined('WP_DEBUG') && WP_DEBUG)
require_once dirname(QUICK_CACHE_PLUGIN_FILE).'/includes/share.php';
else if(@require_once dirname(QUICK_CACHE_PLUGIN_FILE).'/includes/share.php' === FALSE)

This comment has been minimized.

Copy link
@raamdev

raamdev Dec 5, 2014

Contributor

@jaswsinc The bug in this one line caused some catastrophic failure today after a release (a white screen of death that forced manual uninstallation). It wasn't caught during testing because we've been testing with WP_DEBUG enabled and the bug only presents itself when WP_DEBUG is disabled.

This was a rather tricky bug to find, as enabling WP_DEBUG made the problem disappear and no errors were reported in the PHP error_log. I finally tracked it down to this one line by going through all 18 commits since the last release and attempting to revert things one-by-one.

The problem is here, on this line, where you're attempting to compare the return value of require_once(). See Example #4: Comparing return value of include.

The fix is as follows:

else if((@require_once dirname(QUICK_CACHE_PLUGIN_FILE).'/includes/share.php') === FALSE)

Luckily it seems I caught the problem just in time and only a few Lite users were affected.

This comment has been minimized.

Copy link
@jaswrks

jaswrks Dec 5, 2014

The problem is here, on this line, where you're attempting to compare the return value of require_once(). See Example #4: Comparing return value of include.

I did not know this, thanks! Glad you caught it early, shew!

return; // Unable to find class dependency. Fail softly.

/**
* Quick Cache (Advanced Cache Handler)
Expand Down

0 comments on commit d501814

Please sign in to comment.