Deprecated: YoastSEO_Vendor\Symfony\Component\DependencyInjection\Container::__construct(): Implicitly marking parameter $parameterBag as nullable is deprecated in PHP 8.4
- [x] I've read and understood the contribution guidelines.
- [x] I've searched for any related issues and avoided creating a duplicate issue.
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
- Switch to PHP 8.4.1
- Ensure wordpress-seo is activated
- run a WP-CLI command such as
wp plugin status wordpress-seo - 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
- If relevant, which editor is affected (or editors):
- [ ] Block Editor
- [ ] Gutenberg Editor
- [ ] Elementor Editor
- [ ] Classic Editor
- [ ] Other:
- Which browser is affected (or browsers):
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Other:
Used versions
- Device you are using: Dell laptop
- Operating system: Windows
- PHP version: 8.4.1
- WordPress version: 6.7.1
- WordPress Theme: n/a
- Yoast SEO version: 23.9
- Gutenberg plugin version:
- Elementor plugin version:
- Classic Editor plugin version:
- Relevant plugins in case of a bug:
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)
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
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.
WordPress 6.7 (and 6.8) had "beta" support for PHP 8.4 added. And since there's no major WordPress releases for this year and PHP 8.3 active support ending at the end of the year, it would be great to have the major players in WordPress plugin-space to update their plugins to be PHP 8.4 compatible. Even though these deprecation errors are coming from third party packages 🙂
Yeah, I'm currently having to manually patch Yoast and it sucks. Since the criteria for beta support is 10% adoption of PHP 8.4 for WordPress sites this issue causes a bit of a catch 22 for people who are scared of deprecation notices.
https://make.wordpress.org/core/2025/04/09/php-8-support-clarification/
Please fix this.
@josevarghese If I understand you correctly you are waiting for WP to add official beta support for PHP 8.4? If so I'm a bit confused, since that happened in WP 6.7 which was released about a week before your comment. The document you linked states In WordPress 6.7: Added beta support for PHP 8.4.
@stefanfisk To clarify, WordPress 6.7 introduced beta support for PHP 8.4, but this is not equivalent to full, stable support. Our development team will review and decide on PHP 8.4 support in one of our upcoming sprints, based on stability and broader adoption.
In the meantime, we welcome community contributions with open arms. Should you wish to contribute, please refer to our contributing guidelines here.
Manual fix:
in wordpress-seo/vendor_prefixed/symfony/dependency-injection/Container.php
public function __construct(\YoastSEO_Vendor\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null)
{
$this->parameterBag = $parameterBag ?: new \YoastSEO_Vendor\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag();
}
becomes
public function __construct(?\YoastSEO_Vendor\Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface $parameterBag = null)
{
$this->parameterBag = $parameterBag ?: new \YoastSEO_Vendor\Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag();
}
Yoast composer.lock tells us that yoast is using symfony/dependency-injection v3.4.47 which last commit is 5 years old, no php 8.4 at that time.
I guess the work would be to upgrade this package. symfony/dependency-injection 5.4 is the last version that supports php7.4 and would be a good candidate.
@josevarghese I understand you can't prioritize on a deprecation, but saying that you will decide on PHP8.4 support seems weird to me. Do you see a future where you decide not to support PHP8.4 ? 😂
@axi, we are already working on the upgrade of the symfony/dependency-injection to 5.4 at here: https://github.com/Yoast/wordpress-seo/pull/21905
Any updates? The above PR is there since 2024.....
We're trying to update to PHP 8.4 and this is the last blocker. 🙏
8.5 is already coming in a couple of weeks...
Permanent fixes you can apply now (hot‑patch) just by addding a ?
On File: wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/ClientInterface.php find public function getConfig($option = null); add ? before $option so it become : public function getConfig(?$option = null);
Similarly On File wp-content/plugins/wordpress-seo/vendor_prefixed/guzzlehttp/guzzle/src/Client.php Find public function getConfig($option = null); add ? before $option so it become : public function getConfig(?$option = null);
Simialry on File wp-content/plugins/wordpress-seo/vendor_prefixed/league/oauth2-client/src/Provider/AbstractProvider.php Find public function authorize(array $options = [], callable $redirectHandler = null) add ? before $callable so it become :
Why this works: PHP 8.4 deprecates implicit nullability; making $option explicitly nullable (?string) resolves the warning at parse time. This is the exact pattern PHP recommends and works on PHP 7.1+.
@karan4official , we've been running on PHP 8.4 without issues for ages, but since yesterday, we're seeing an error from Yoast. Any idea why this is suddenly happening now? Did they release a new update recently that might have caused this?
These deprecation errors have been sitting around for way too long.
Please inform the customer of conversation # 1328883 when this conversation has been closed.
#21905 has been merged last week, it should be fine soon.
See https://github.com/Yoast/wordpress-seo/releases/tag/26.5-RC1