Problem/Motivation

Drupal alert

Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated in Drupal\yoast_seo\YoastSeoManager->__construct() (line 44 of modules/contrib/yoast_seo/src/YoastSeoManager.php).

Steps to reproduce

Have module enabled on site running PHP 8.2

Issue fork yoast_seo-3362165

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

wilksdotco created an issue. See original summary.

yogesh_kambari’s picture

Assigned: Unassigned » yogesh_kambari

yogesh_kambari’s picture

StatusFileSize
new132.54 KB

I have reviewed the MR and i can see no Drupal alert is coming now.

yogesh_kambari’s picture

Assigned: yogesh_kambari » Unassigned
Status: Active » Reviewed & tested by the community
wilksdotco’s picture

StatusFileSize
new0 bytes

Please ignore, added incorrect diff

wilksdotco’s picture

bramdriesen’s picture

Version: 8.x-1.8 » 8.x-1.x-dev
Status: Reviewed & tested by the community » Needs work

@yogesh_kambari Please, when doing code reviews also look at the actual code being written. Just testing if the code applies is not sufficient to set an issue to RTBC.

amatzies made their first commit to this issue’s fork.

dmytro-aragorn’s picture

Assigned: Unassigned » dmytro-aragorn
dmytro-aragorn’s picture

Assigned: dmytro-aragorn » Unassigned
Status: Needs work » Needs review
StatusFileSize
new4.01 KB

I couldn't push any changes into existing MR so here is a patch with a fix of YoastSeoFieldManager service usage.

socialnicheguru’s picture

Status: Needs review » Needs work

Using composer to install I get an error:

- Installing drupal/yoast_seo (1.8.0): Extracting archive
- Applying patches for drupal/yoast_seo
https://www.drupal.org/files/issues/2023-07-28/yoast_seo-3362165-depreca... (Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated in Drupal\yoast_seo\YoastSeoManager->__construct() (line 44 of modules/contrib/yoast_seo/src/YoastSeoManager.php).)
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-07-28/yoast_seo-3362165-depreca...

bramdriesen’s picture

Status: Needs work » Needs review

@SocialNicheGuru Patches are for the dev release. Not for the latest stable release. If needed you need to rebase the patch manually in order to resolve the conflicts on that release and export it into a new patch file to use.

socialnicheguru’s picture

The dev and the current release have the same release date Dec 16 2022.
I assumed they are the same. I guess not.

COBadger made their first commit to this issue’s fork.

cobadger’s picture

Updated the merge request to correct YoastSeoManager's definition of the Yoast SEO Field Manager, and to inject additional services per Drupal coding standards.

plach’s picture

StatusFileSize
new427 bytes

The changes in the MR make things way cleaner, but they seem out of scope for this issue. I'm attaching a patch with the only change that I think is required to get rid of the warning. It would be good to create a separate issue to clean up service injection.

rajab natshah’s picture

Title: Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated in Drupal\yoast_seo\YoastSeoManager->__construct() (line 44 of modules/contrib/yoast_seo/src/YoastSeoManager.php). » Fix Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated in Drupal\yoast_seo\YoastSeoManager->__construct() (line 44 of modules/contrib/yoast_seo/src/YoastSeoManager.php).
Status: Needs review » Reviewed & tested by the community
rajab natshah’s picture

Title: Fix Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated in Drupal\yoast_seo\YoastSeoManager->__construct() (line 44 of modules/contrib/yoast_seo/src/YoastSeoManager.php). » Fix Deprecated function: Creation of dynamic property Drupal\yoast_seo\YoastSeoManager::$yoast_seo_field_manager is deprecated
rishi.kulshreshtha’s picture

Patch in comment #19 fixed the issue. Thanks.

fernly’s picture

Noting that this issue is already fixed in version 2 of this module. However this could still be merged into version 1.x.

jmcintyre’s picture

Could this please be merged into 1.x? Version 2 is still only in alpha... Many thanks!

arunkumark’s picture

Verified the patch is applied to the 1.x version(Tested on the drupal/yoast_seo 1.9.0 version) and the warning was removed after the patch.

The latest version 2.x works fine without the warning message.

+RTBC

kburakozdemir’s picture

Drupal 10.5.4

drupal/yoast_seo (1.9.0)

PHP Version 8.3.23

#19 fixed the issue. thanks.

+RTBC