The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Write access, PHP 8...
 
Share:
Notifications
Clear all

Write access, PHP 8 warnings and a solution

9 Posts
2 Users
0 Reactions
932 Views
Posts: 15
Topic starter
(@aohagan)
Eminent Member
Joined: 3 years ago

We are hosted on WordPress VIP, and since updating to PHP 8.0 our debug logs are full of the below errors:

PHP message: Warning: foreach() argument must be of type array|object, bool given in /var/www/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1678 [www.oursite.com.au/2011/03/28/digital-media-convergence-where-legal-and-ethical-lines-blur-too/] [wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelper.php:349 wpdFormAttr\Form->getThemes(), wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:1256 WpdiscuzHelper->enqueueWpDiscuzStyle(), wp-includes/class-wp-hook.php:308 WpdiscuzCore->frontendFiles(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/script-loader.php:2180 do_action('wp_enqueue_scripts'), wp-includes/class-wp-hook.php:308 wp_enqueue_scripts(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/general-template.php:3043 do_action('wp_head'), wp-content/themes/oursite/header.php:58 wp_head(), wp-includes/template.php:783 require_once('wp-content/themes/oursite/header.ph...

PHP message: Warning: scandir(vip://wp-content/uploads/wpdiscuz/themes/): Failed to open directory: "Automattic\VIP\Files\VIP_Filesystem_Stream_Wrapper::dir_opendir" call failed in /var/www/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1675 [www.oursite.com.au/2022/12/06/ukraine-russia-war-europe-weapons/] [wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1675 scandir(), wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelper.php:349 wpdFormAttr\Form->getThemes(), wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:1255 WpdiscuzHelper->enqueueWpDiscuzStyle(), wp-includes/class-wp-hook.php:308 WpdiscuzCore->frontendFiles(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/script-loader.php:2180 do_action('wp_enqueue_scripts'), wp-includes/class-wp-hook.php:308 wp_enqueue_scripts(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/general-template.php:3043 do_...

PHP message: Warning: scandir(): (errno 13): Permission denied in /var/www/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1675 [www.oursite.com.au/2022/12/06/ukraine-russia-war-europe-weapons/] [wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1675 scandir(), wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelper.php:349 wpdFormAttr\Form->getThemes(), wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:1255 WpdiscuzHelper->enqueueWpDiscuzStyle(), wp-includes/class-wp-hook.php:308 WpdiscuzCore->frontendFiles(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/script-loader.php:2180 do_action('wp_enqueue_scripts'), wp-includes/class-wp-hook.php:308 wp_enqueue_scripts(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/general-template.php:3043 do_action('wp_head'), wp-content/themes/oursite/header.php:58 wp_head(), wp-includes/template.php:783 require_once('wp-content/th...

We did some digging and worked out what the issue was:

WordPress VIP does not allow upload folder write access to plugins, hence the issues above.

We had to modify the code in one of your files, but this resolved the issue for us. In short, we also check not only that the folder exists, but that the folder has write_permissions as well.

I thought I'd share given that we can't be the only ones affected by this. This replaces the file in forms/wpdFormAttr/

8 Replies
Asti
Posts: 7617
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

Thank you aohagan,

I've asked the developers to check the issue. 

Reply
Asti
Posts: 7617
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

@aohagan,

Please revert back the customizations you're making and use this one:

The changes you've done are not a good solution. 

Reply
Posts: 15
Topic starter
(@aohagan)
Eminent Member
Joined: 3 years ago

Thanks for the response Asti.

We ran the code you provided, and it it has returned 2 of the 3 warning errors. 

PHP message: Warning: scandir(vip://wp-content/uploads/wpdiscuz/themes/): Failed to open directory: "Automattic\VIP\Files\VIP_Filesystem_Stream_Wrapper::dir_opendir" call failed in /var/www/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1675 [www.oursite.com.au/2022/12/06/ukraine-russia-war-europe-weapons/] [wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1675 scandir(), wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelper.php:349 wpdFormAttr\Form->getThemes(), wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:1255 WpdiscuzHelper->enqueueWpDiscuzStyle(), wp-includes/class-wp-hook.php:308 WpdiscuzCore->frontendFiles(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/script-loader.php:2180 do_action('wp_enqueue_scripts'), wp-includes/class-wp-hook.php:308 wp_enqueue_scripts(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/general-template.php:3043 do_...

PHP message: Warning: scandir(): (errno 13): Permission denied in /var/www/wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php on line 1675 [www.oursite.com.au/2022/12/06/ukraine-russia-war-europe-weapons/] [wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1675 scandir(), wp-content/plugins/wpdiscuz/utils/class.WpdiscuzHelper.php:349 wpdFormAttr\Form->getThemes(), wp-content/plugins/wpdiscuz/class.WpdiscuzCore.php:1255 WpdiscuzHelper->enqueueWpDiscuzStyle(), wp-includes/class-wp-hook.php:308 WpdiscuzCore->frontendFiles(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/script-loader.php:2180 do_action('wp_enqueue_scripts'), wp-includes/class-wp-hook.php:308 wp_enqueue_scripts(), wp-includes/class-wp-hook.php:332 WP_Hook->apply_filters(), wp-includes/plugin.php:517 WP_Hook->do_action(), wp-includes/general-template.php:3043 do_action('wp_head'), wp-content/themes/oursite/header.php:58 wp_head(), wp-includes/template.php:783 require_once('wp-content/th...

We're happy to test anything you provide, but will continue with our solution for now given that it has been running successfully on our production sites for a number of days without incident.

Reply
5 Replies
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7617

Thank you for checking @aohagan,

Could you please check this one as well? 

Please keep us informed. 

Reply
(@aohagan)
Joined: 3 years ago

Eminent Member
Posts: 15

Thanks again @asti - we ran the code you provided, and it it has returned the same 2 warning errors.

PHP message: Warning: scandir(vip://wp-content/uploads/wpdiscuz/themes/): Failed to open directory: "Automattic\VIP\Files\VIP_Filesystem_Stream_Wrapper::dir_opendir" call failed
wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1679

PHP message: Warning: scandir(): (errno 13): Permission denied
wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1679

I'd suggest for testing purposes changing the uploads folder to not writeable so you can reproduce what we're seeing here.

Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7617

ok @aohagan,

Then use your solution. The developers will also try to implement the best solution in future versions. 

Reply
Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7617

Could you please let us know if the issue is fixed in the newest version of the wpDiscuz (v. 7.5.3)? 

Reply
(@aohagan)
Joined: 3 years ago

Eminent Member
Posts: 15

@asti Same as before.

We're still seeing these same errors with your latest plugin release.

PHP message: Warning: scandir(vip://wp-content/uploads/wpdiscuz/themes/): Failed to open directory: "Automattic\VIP\Files\VIP_Filesystem_Stream_Wrapper::dir_opendir" call failed
wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1679

PHP message: Warning: scandir(): (errno 13): Permission denied
wp-content/plugins/wpdiscuz/forms/wpdFormAttr/Form.php:1679

Let me know if you want to see our patched files again.

Reply
Share: