Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
While upgrading a site to D9, I ran into an issue that was not caught by upgrade_status: references to the 'path.alias_manager' service. This service has been renamed to 'path_alias.manager'.
Proposed resolution
Check for occurrences of 'path.alias_manager'.
Comments
Comment #2
marcvangendComment #3
jukka792 CreditAttribution: jukka792 as a volunteer commentedHi,
I run into same problem, and it is very difficult to find out which module is causing this.
Comment #5
Gábor Hojtsy@anoopjohn reported the same at #3220409: Upgrade Status module did not catch changed service name path.alias_manager => path_alias.manager
Comment #6
mglamanThis should be possible in phpstan-drupal. Opened https://github.com/mglaman/phpstan-drupal/issues/192
Comment #7
Eric_A CreditAttribution: Eric_A at RIVM, Dutch Open Projects commentedEDIT: drupal-rector catches a bit of this, but not all cases, so only a little bit of inspiration to find there.
FYI, I just did a quick search in one project and found occurrences in the paragraphs_report Drupal module.
palantirnet/drupal-rector catches
Drupal::service()
calls, but it apparently does not catch arguments to services and retrieving the service from the container. Below is code from paragraphs_report:Comment #8
kunalkursija CreditAttribution: kunalkursija at Axelerant commented+1
I faced this too, where deprecated service usage in Global calls to
\Drupal::service('path.alias_manager')
are not being called deprecated.Comment #9
mglamanComment #10
mglamanDeprecations will be reported if you use:
The following issue will fix
\Drupal::service()
callshttps://github.com/mglaman/phpstan-drupal/issues/190
I'll update the issue when it's available to test
Comment #11
mglamanThe fix for
\Drupal::service
calls has been added to phpstan-drupal:0.12.15, which should provide all the required coverage for detecting the access of deprecated services.Can you please run a Composer update to get the latest phpstan-drupal version and verify? If so, we can bump the minimum version for upgrade_status.
Comment #12
Gábor HojtsyThanks @mglaman. This should fix it for Upgrade Status once people do a composer update.
Comment #13
Gábor Hojtsy