littlebizzy / slickstack

Lightning-fast WordPress on Nginx
https://slickstack.io
GNU General Public License v3.0
629 stars 112 forks source link

parameter warnings caused by xxx-common.php MU plugin #134

Closed anorouzi closed 2 years ago

anorouzi commented 2 years ago

Everything look fine in the server, but I got these errors in logs(/var/www/logs/error.log). How to solve it?

[13-Jan-2022 10:07:40 UTC] PHP Warning: fgets() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 329 [13-Jan-2022 10:07:40 UTC] PHP Warning: fread() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 320 [13-Jan-2022 10:07:40 UTC] PHP Warning: fseek() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 319 [13-Jan-2022 10:07:40 UTC] PHP Warning: fread() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 320 [13-Jan-2022 10:07:40 UTC] PHP Warning: fseek() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 319 [13-Jan-2022 10:07:40 UTC] PHP Warning: fread() expects parameter 1 to be resource, bool given in /var/www/html/wp-content/mu-plugins/xxx-common.php on line 320

P.S: There is lot of them sometimes.

jessuppi commented 2 years ago

Thanks for reporting this @anorouzi and apologies for the slow respond here...

There were a few reasons for this happening previously:

  1. sloppy code in xxx-common.php
  2. we had some booleans in ss-constants.php
  3. we had WP_DEBUG enabled in wp-config.php in production by default (due to a bug)

In the past few months we've cleaned up all 3 of these files a lot, and going forward, we will no longer EVER have booleans in the MU plugin xxx-common.php or ss-constants.php to avoid potential fatal errors and otherwise.

Ref: https://github.com/littlebizzy/slickstack/blob/master/modules/wordpress/mu-plugins/xxx-common.txt Ref: https://github.com/littlebizzy/slickstack/blob/master/modules/php-fpm/ss-constants.txt Ref: https://github.com/littlebizzy/slickstack/blob/master/modules/wordpress/wp-config.txt

Thanks again for opening this, it should be resolved for now.