Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 895 forks source link

Deprecated: YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated in PHP 8.4 #21859

Open bobbingwide opened 4 days ago

bobbingwide commented 4 days ago

Please give us a description of what happened

This message is produced with PHP 8.4.1

Deprecated: YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated, the explicit nullable type must be used instead in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\vendor_prefixed\symfony\dependency-injection\Container.php on line 60

To Reproduce

Step-by-step reproduction instructions

  1. Switch to PHP 8.4.1
  2. Ensure wordpress-seo is activated
  3. run a WP-CLI command such as wp plugin status wordpress-seo
  4. Notice several Deprecated messages... one of which is produced for WordPress SEO; the other 3 are from WP-CLI

Expected results

Plugin wordpress-seo details: Name: Yoast SEO Status: Active Version: 23.9 Author: Team Yoast Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.

Actual results

C:\apache\htdocs\wordpress\wp-content\plugins\oik>wp plugin status wordpress-seo

Deprecated: WP_CLI\Runner::get_subcommand_suggestion(): Implicitly marking parameter $root_command as nullable is deprecated, the explicit nullable type must be used instead in phar://C:/d_drive/dos/wp-cli.phar/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php on line 1958 Deprecated: YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated, the explicit nullable type must be used instead in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\vendor_prefixed\symfony\dependency-injection\Container.php on line 60 Deprecated: Mustache_Engine::loadSource(): Implicitly marking parameter $cache as nullable is deprecated, the explicit nullable type must be used instead in phar://C:/d_drive/dos/wp-cli.phar/vendor/mustache/mustache/src/Mustache/Engine.php on line 727 Deprecated: Mustache_Parser::buildTree(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in phar://C:/d_drive/dos/wp-cli.phar/vendor/mustache/mustache/src/Mustache/Parser.php on line 73 Plugin wordpress-seo details: Name: Yoast SEO Status: Active Version: 23.9 Author: Team Yoast Description: The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.

Screenshots, screen recording, code snippet

See output above.

Technical info

Used versions

For my environment the fix is easy. Add a ? to line 60 of the file mentioned.

public function __construct(?\YoastSEO_Vendor\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null)
bobbingwide commented 4 days ago

I've received several other Deprecated messages that should also be addressed.

[23-Nov-2024 17:25:52 UTC] PHP Deprecated: YoastSEO_Vendor\League\OAuth2\Client\Provider\AbstractProvider::authorize(): Implicitly marking parameter $redirectHandler as nullable is deprecated, the explicit nullable type must be used instead in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\vendor_prefixed\league\oauth2-client\src\Provider\AbstractProvider.php on line 416 [23-Nov-2024 17:25:52 UTC] PHP Deprecated: YoastSEO_Vendor\GuzzleHttp\Client::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\vendor_prefixed\guzzlehttp\guzzle\src\Client.php on line 181 [23-Nov-2024 17:25:52 UTC] PHP Deprecated: YoastSEO_Vendor\GuzzleHttp\ClientInterface::getConfig(): Implicitly marking parameter $option as nullable is deprecated, the explicit nullable type must be used instead in C:\apache\htdocs\wordpress\wp-content\plugins\wordpress-seo\vendor_prefixed\guzzlehttp\guzzle\src\ClientInterface.php on line 77

josevarghese commented 3 days ago

Hi @bobbingwide

Thanks for creating the issue.

As WP had added “beta support” for PHP 8.3 in version 6.4 and there are no mentions of 8.4 till now, the deprecation message for PHP 8.4 is expected. Our team will fix deprecated messages for PHP 8.4 when WP is fully compatible. As there are no mentions of PHP 8.4 within the WP document shared above, it may take some time.

If the issue occurs with PHP 8.3, please let us know.