Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 support #27674

Closed
7 tasks done
peterfabian opened this issue Sep 15, 2020 · 20 comments
Closed
7 tasks done

PHP 8 support #27674

peterfabian opened this issue Sep 15, 2020 · 20 comments
Labels
type: enhancement The issue is a request for an enhancement. type: epic Container issue with high-level description of work that will be done in sprint. type: task The issue is an internally driven task (e.g. from another A8c team).

Comments

@peterfabian
Copy link
Contributor

peterfabian commented Sep 15, 2020

Similarly to WordPress 5.6 (planned for 8 December 2020), we need to start preparations to be fully compatible with PHP 8 once it lands on November 26, 2020.

We need to

WP core trac ticket for some reference: https://core.trac.wordpress.org/ticket/50913

Related: p59oML-1O4-p2

Related pull requests:

Checked items are already merged.

@peterfabian peterfabian added type: task The issue is an internally driven task (e.g. from another A8c team). type: enhancement The issue is a request for an enhancement. labels Sep 15, 2020
@Preciousomonze
Copy link

Wow, this is fast, good one people 🤯🥳

@peterfabian peterfabian added this to the 4.7.0 milestone Sep 24, 2020
@peterfabian
Copy link
Contributor Author

Milestoning for 4.7, as that is the last release before WP 5.6 gets released, but not everything might be ready by then, so we might need to adjust the plan.

@peterfabian
Copy link
Contributor Author

peterfabian commented Sep 29, 2020

Errors seen in initial testing:

FireShot Capture 050 - Profiler ‹ WooCommerce ‹ wootest — WooCommerce - woo loc
FireShot Capture 047 -  - woo loc

@Konamiman
Copy link
Contributor

I've found that when trying to manually create an order, WC_Abstract_Order->get_total_discount does a round('') which results in CRITICAL Uncaught TypeError: round(): Argument #1 ($number) must be of type int|float, string given

@peterfabian
Copy link
Contributor Author

peterfabian commented Oct 2, 2020

Latest update from WP core:

Sergeybiryukov shared that work on PHP 8 support has continued. All known unit test issues have been addressed, and the tests are now passing on PHP 8. #50913 includes most of the progress on this, some work was also done in other related tickets: https://core.trac.wordpress.org/query?keywords=~php8

Next steps for PHP 8 support:

Docker image needs to be updated to use the same PHP extensions for PHP 8 that we have on PHP 7.x: gd, mbstring, etc. There is a PR by Desrosj waiting for review: WordPress/wpdev-docker-images#36. If anyone is able to help with that, please do.
There is an ongoing effort to fix some function argument type issues reported by PHPStan (a static analyzer): #51423.
More testing on PHP 8, expanding test coverage, and creating tickets for any issues found. Andraganescu and Desrosj are working on a call for testing to be published later.

@peterfabian
Copy link
Contributor Author

@claudiosanches
Copy link
Contributor

@peterfabian Currently it's missing only to update our Unit Tests, but this isn't something that depends on a release and can be merged at any time. I'm going to remove the 4.7 milestone, since 4.7 already includes all other changes.

@Konamiman Thank you very much for all your work!

@peterfabian
Copy link
Contributor Author

Just trying to add PHP 8 to our CI as part of #27844 and we can close this one.

@Konamiman
Copy link
Contributor

Closing as we've recently merged #27844, which was the last pending PR on this subject.

@genuino2
Copy link

FATAL ERROR with php 8 on customer-processing-order.php on:
do_action( 'woocommerce_email_order_meta', $order, $sent_to_admin, $plain_text, $email );

@Konamiman
Copy link
Contributor

Hi @genuino2, thanks for your report. Could you please provide more details on what the exact error is and what are the steps to get it?

@genuino2
Copy link

genuino2 commented Feb 25, 2022 via email

@Konamiman
Copy link
Contributor

Thanks @genuino2 but I'd need some more details:

  • What WooCommerce version are you using?
  • Which is the original theme in which you are also getting the error?
  • Could you please provide the detailed usage steps that trigger the error?

Thank you!

@genuino2
Copy link

genuino2 commented Feb 28, 2022 via email

@dadart123
Copy link

dadart123 commented Sep 14, 2022

Woocommerce 6.9.0
Hello everyone,
My site has this error if I use php 8.0 and later

  1. PHP Fatal error: Uncaught TypeError: array_filter(): Argument line-height in h1 - email notification #1 ($array) must be of type array, bool given in /wp-content/plugins/woocommerce/includes/class-wc-frontend-scripts.php:65
    If I go back to php 7.4 the problem is not there
    Can you help me solve the problem in order to upgrade to PHP 8.00
    Thank you very much
    Eleonora

Fixed with this solution
Please add this to your child theme's functions.php to temporarily resolve this issue:

add_filter( 'woocommerce_enqueue_styles', 'wc_child_theme_fix_33467', PHP_INT_MAX );

function wc_child_theme_fix_33467( $styles ) {
return ( is_array( $styles ) ) ? $styles : [];
}

@beaulebens
Copy link
Contributor

@dadart123 this should be addressed in 6.9.1, per #34671

@gg4midas
Copy link

woocommerce 7.1
theme: astra
My site has this error if I use PHP 8.1 and 8.0:

Error Details

An error of type E_ERROR was caused in line 37 of the file /www/wwwroot/sweetener/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php. Error message: Uncaught Error: Call to undefined function putenv() in /www/wwwroot/sweetener/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images-request.php:37
Stack trace:
#0 /www/wwwroot/sweetener/wp-content/plugins/woocommerce/includes/class-wc-regenerate-images.php(49): WC_Regenerate_Images_Request->__construct()
#1 /www/wwwroot/sweetener/wp-includes/class-wp-hook.php(308): WC_Regenerate_Images::init()
#2 /www/wwwroot/sweetener/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#3 /www/wwwroot/sweetener/wp-includes/plugin.php(517): WP_Hook->do_action()
#4 /www/wwwroot/sweetener/wp-settings.php(617): do_action()
#5 /www/wwwroot/sweetener/wp-config.php(100): require_once('...')
#6 /www/wwwroot/sweetener/wp-load.php(50): require_once('...')
#7 /www/wwwroot/sweetener/wp-admin/admin.php(34): require_once('...')
#8 /www/wwwroot/sweetener/wp-admin/index.php(10): require_once('...')
#9 {main}
thrown

@beaulebens
Copy link
Contributor

@gg4midas please follow #31942 for discussion of the specific issue you're seeing.

@michaelbgibs
Copy link

I keep getting this error message and it's a core alert. I have no idea why and it only happens when I use any php version higher than 7.4 with WordPress 6.22.

Uncaught Error: array_filter(): Argument #1 ($array) must be of type array, null given

wp-includes/class-wp-user-query.php:479

Any when I try to edit any page, I get a Fatal response:

array_filter() expects parameter 1 to be array, null given

wp-includes/class-wp-user-query.php:479
array_filter()
wp-includes/class-wp-user-query.php:479
WP_User_Query->prepare_query()
wp-includes/class-wp-user-query.php:78
WP_User_Query->__construct()
wp-includes/user.php:775
get_users()
wp-includes/user.php:1667
wp_dropdown_users()
wp-admin/includes/class-wp-posts-list-table.php:1711
WP_Posts_List_Table->inline_edit()
wp-admin/edit.php:493

Can you help me?

@Konamiman
Copy link
Contributor

Hi @michaelbgibs. Could you please confirm if this error appears only if WooCommerce is installed? If that's the case, could you please create a new issue with detailed reproduction steps? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement The issue is a request for an enhancement. type: epic Container issue with high-level description of work that will be done in sprint. type: task The issue is an internally driven task (e.g. from another A8c team).
Projects
None yet
Development

No branches or pull requests

9 participants