kovshenin / surge

Surge is a very simple and fast page caching plugin for WordPress.
GNU General Public License v3.0
152 stars 12 forks source link

PHP Warning: flock() expects parameter 1 to be resource, bool given #40

Open rilwis opened 2 months ago

rilwis commented 2 months ago

When I update WordPress to 6.5.5 via WP-CLI, I got the following warnings:

Updating to version 6.5.5 (en_US)...
Using cached file '/home/ubuntu/.wp-cli/cache/core/wordpress-6.5.5-partial-4-en_US.zip'...
Unpacking the update...
Success: WordPress updated successfully.
PHP Warning:  fopen(/var/www/domain.com/wp-content/cache/surge/flags.json.php): failed to open stream: Permission denied in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 170
Warning: fopen(/var/www/domain.com/wp-content/cache/surge/flags.json.php): failed to open stream: Permission denied in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 170
PHP Warning:  flock() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 173
Warning: flock() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 173
PHP Warning:  fread() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 176
Warning: fread() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 176
PHP Warning:  ftruncate() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 194
Warning: ftruncate() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 194
PHP Warning:  rewind() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 195
Warning: rewind() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 195
PHP Warning:  fwrite() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 198
Warning: fwrite() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 198
PHP Warning:  fclose() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 199
Warning: fclose() expects parameter 1 to be resource, bool given in /var/www/domain.com/wp-content/plugins/surge/include/invalidate.php on line 199

The user in WP-CLI is not a root user. It's the owner of the WP root folder (not www-data). I guess it has something wrong with the permission, but I'm not sure.

Please take a look.

kovshenin commented 1 week ago

Thanks for the report. Looks like the owner of the WP root folder and the owner of the actual files in that folder are different users? Who does /var/www/domain.com/wp-content/cache/surge/flags.json.php belong to and what are the permissions on that? Does the plugin continue to work as expected after the update?