pods icon indicating copy to clipboard operation
pods copied to clipboard

Improve PHP 8.4 Compatibility

Open BrookeDot opened this issue 8 months ago • 2 comments

Description

Pods currently runs under PHP 8.4 without any fatal errors, however there are many deprecation warnings that should be addressed for full compatibility. Here is a quick list I am pulling from Query Monitor:


    wp-content/plugins/pods/src/Pods/Container/Container_DI52.php:55

	1	Plugin: pods
Deprecated	Pods\Container\Container_DI52::singleton(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/src/Pods/Container/Container_DI52.php:83

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::singleton(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:155

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::bind(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:533

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::singletonDecorators(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:579

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::getDecoratorBuilder(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:595

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::bindDecorators(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:629

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Container::instance(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Container.php:808

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\Resolver::resolveWithArgs(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/Resolver.php:177

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\Resolver::resolve(): Implicitly marking parameter $buildLine as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/Resolver.php:204

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\Resolver::cloneBuilder(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/Resolver.php:278

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\Factory::getBuilder(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/Factory.php:63

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\ClassBuilder::__construct(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/ClassBuilder.php:82

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\ClassBuilder::reinit(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/ClassBuilder.php:243

	1	Plugin: pods
Deprecated	Pods\Prefixed\lucatume\DI52\Builders\ReinitializableBuilderInterface::reinit(): Implicitly marking parameter $afterBuildMethods as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/vendor/vendor-prefixed/lucatume/di52/src/Builders/ReinitializableBuilderInterface.php:29

	1	Plugin: pods
Deprecated	Pods\REST\V1\Endpoints\Base::__construct(): Implicitly marking parameter $post_repository as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/src/Pods/REST/V1/Endpoints/Base.php:79

	1	Plugin: pods
Deprecated	Pods\REST\V1\Endpoints\Base::__construct(): Implicitly marking parameter $validator as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/src/Pods/REST/V1/Endpoints/Base.php:79

	1	Plugin: pods
Deprecated	Pods\REST\V1\Endpoints\Base::get_by_args(): Implicitly marking parameter $request as nullable is deprecated, the explicit nullable type must be used instead	

    wp-content/plugins/pods/src/Pods/REST/V1/Endpoints/Base.php:491

	1	Plugin: pods
Deprecated	preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated	

    wp-content/plugins/pods/components/Templates/Templates.php:632

	2	Plugin: pods
Deprecated	preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated````

It would likely be best to address this in several commits, I can take a look at some of the low hanging fruit here outside of the lucatume\DI52\ library but would appreciate some additional eyes on if that library can be upgraded to 4.0 which according to the author fixes the deprecation warnings:

  • https://github.com/lucatume/di52/releases/tag/4.0.0

It looks like there are two primary areas that need compatibility fixes:

[ ] Upgrade the D152 library [ ] Fix REST API to not be nullable - I'll make a PR for this shortly.

Version

3.2.8.2

Testing Instructions

  1. Install PHP 8.4 on a WordPress install with Pods
  2. Check PHP logs for Deprecation notices, using Query Monitor is an easy way to do this.

Screenshots / Screencast

No response

Possible Workaround

  • Downgrade to PHP 8.3
  • Ignore or disable PHP WARNINGS
  • manually change the code

Site Health Information


Pods Package


BrookeDot avatar Feb 18 '25 19:02 BrookeDot