1 of 11

WP and PHP

LATEST VERSIONS, CHALLENGES AND SOLUTIONS

2 of 11

About me

  • @kagg-design - the sole holder of gold WordPress badge and bronze WooCommerce badge on Stack Overflow RU
  • Team Lead in Awesome Motive (WPForms plugin, 6+ millions of installs)
  • WordPress Core Contributor
  • Plugin developer
      • Leading developer of Cyr-To-Lat plugin (200,000+ active installs)
      • Leading developer of hCaptcha plugin (60,000+ active installs)

3 of 11

Content

  • The “just_in_time” notice
  • Translations in WordPress 6.5+
  • PHP 8.4 – general aspects
  • Implicitly marking as nullable
  • Fixing libraries
  • WP and PHP version statistics
  • Plugin statistics

4 of 11

The “just_in_time” notice

    • Notice: Function _load_textdomain_just_in_time was called incorrectly.
      • Why has it happened?
          • wp-includes/l10n.php:1369.
          • 90% of plugins and themes are affected.
      • How to fix it?
          • Move all you code using translation functions like __() after `after_setup_theme`.
          • Previously, docs said that load_text_domain() can be used after `plugins_loaded`.
      • How to suppress - with an example.
          • Too much code to move. So, how to suppress?
          • hCaptcha on wp.org and GitHub: src/php/ErrorHandler.php.

5 of 11

Translations in WordPress 6.5+

    • Some translations are missed upon WP 6.5.
      • Why?
          • A new code was introduced in WP 6.5.
      • How to fix it in translation packages?
          • Do not leave empty translations
      • How to fix it in the plugin?
          • \HCaptcha\ErrorHandler::filter_gettext

6 of 11

PHP 8.4 – general aspects

  • General aspects of the compatibility.
      • WordPress is not fully compatible with PHP 8.0 – 8.4.
      • See PHP Compatibility and WordPress Versions.
      • Remaining known PHP 8.0+ issues are deprecation notices.
      • The solution is to suppress deprecation messages. KAGG Compatibility plugin on wp.org.
    • How to find problems in the code?
      • Code sniffer is still not ready
      • Use find . -name "*.php" -not -path "*/vendor/*" -exec php -l {} \;

7 of 11

Implicitly marking as nullable

  • PHP Deprecated: ... Implicitly marking parameter ... as nullable is deprecated, the explicit nullable type must be used instead in ...
    • Example
      • wp-content\plugins\woocommerce\packages\action-scheduler\classes\data-stores\ActionScheduler_DBStore.php on line 863
      • Simplest case: function foo( string $bar = null) {
    • How to fix in PHP 7.1+
      • function foo( ?string $bar = null) {
    • How to fix in PHP 7.0
    • Conclusion: to support 8.4,�we need to upgrade to 7.1+

8 of 11

Fixing libraries

  • To stop receiving “implicitly marked as nullable” in tests, I have fixed the following test libraries:

9 of 11

WP and PHP version statistics

  • Statistics of using WP and PHP versions.

10 of 11

Plugin statistics

  • The requirements of top plugins to compare:
      • Contact Form 7 (10M installs): PHP 7.4. WP 6.6 (wow)
      • Elementor (10M): PHP 7.4, WP 6.3
      • WooCommerce (7M): PHP 7.4, WP 6.5
      • WPForms (6M): PHP 7.0, WP 5.5
      • MailChimp (2M): PHP 7.2, WP 4.4
      • Ninja Forms (0.8M): PHP 7.2, WP 6.4
      • Gravity Forms (?): PHP 5.6, WP 4.0 (pretty antique, huh?)
      • Forminator (0.3M): PHP 7.4, WP 6.4
      • Formidable Forms (0.3M): PHP 7.0, WP 5.2
      • Fluent Forms (0.2M): PHP 7.4, WP 4.5

As we can see, big players with number of installs are not afraid to raise PHP and WP versions. They customers are following the tendency, updating environments.

11 of 11

Thank you

SO LONG