Hi,

I installed the module on Drupal 8.9.1 via composer and cannot activate it. The message:
Upgrade Status should be used on a Drupal 8 site to detect deprecated APIs present. It does not in itself know about deprecated APIs and Drupal 9 does not have Drupal 8's deprecated APIs anymore.

Any idea how to fix it?

Comments

superfedya created an issue. See original summary.

isalmanhaider’s picture

Following!

I am on Drupal 8.9.1 installed upgrade_status through composer, but when I try to enable I get this error

"Error message Upgrade Status should be used on a Drupal 8 site to detect deprecated APIs present. It does not in itself know about deprecated APIs and Drupal 9 does not have Drupal 8's deprecated APIs anymore."

greatmatter’s picture

That patch only duplicates the problem code...I think...

onejam’s picture

I ran into the same problem. After installing Status Upgrade module 2.8 via composer, i am not able to enable this module. Tried the patch #3 but doesn't fix it. I'm also running Drupal 8.9.1

superfedya’s picture

This patch is already installed in the last version, doesn't work.

RedPlanet’s picture

Hello, I have the same problem with version 2.8 installed by composer, Drupal is on version 8.8.8.

The patch from message #3 did not work, any other ideas?

mmjvb’s picture

Category: Support request » Bug report

if (version_compare('9.0.0', \Drupal::VERSION) >= 0) {
should read
if (version_compare('9.0.0', \Drupal::VERSION) < 0) {
or
if (version_compare(\Drupal::VERSION, '9.0.0' ) >= 0) {

EDIT
My mistake, error should be provided in case of 9.0.0 or higher
if (version_compare('9.0.0', \Drupal::VERSION) < 1) {
or
if (version_compare('9.0.0', \Drupal::VERSION) <= 0) {
as written in the patch

mmjvb’s picture

Priority: Normal » Major

Considering you can't use the module on the intended version of Drupal, set to major.

gábor hojtsy’s picture

Priority: Major » Critical

Oops. I wonder how can our automated testing install it on 8.9?

gábor hojtsy’s picture

So as per https://www.php.net/manual/en/function.version-compare.php

By default, version_compare() returns -1 if the first version is lower than the second, 0 if they are equal, and 1 if the second is lower.

So

if (version_compare('9.0.0', \Drupal::VERSION) >= 0) {

Is indeed entirely wrong as an error condition. It would fire if the version would be supported but also for 9.0.0. It should be <=.

gábor hojtsy’s picture

Title: Cannot enable the module » Cannot enable the module on Drupal 8
Component: Documentation » Code

  • Gábor Hojtsy committed 5a4a90d on 8.x-2.x
    Issue #3153396 by superfedya, Gábor Hojtsy, isalmanhaider, mmjvb, onejam...
gábor hojtsy’s picture

Status: Active » Fixed
gábor hojtsy’s picture

Released https://www.drupal.org/project/upgrade_status/releases/8.x-2.9. So sorry for this mistake. Hope it all works now.

gábor hojtsy’s picture

mmjvb’s picture

Still wrong in my opinion. Would allow install on 9.0.0 !

gábor hojtsy’s picture

Hm why? Returns 0 if they are equal no?

mmjvb’s picture

Indeed, equal returns 0. My understanding is you don't want it on 9.0.0. Which means < 0, not <= 0.

gábor hojtsy’s picture

No. Using the project on any version of Drupal 9 would return a very misleading and limited result set. People should use this project on Drupal 8. Yes I could also make it incompatible with Drupal 9 with composer but that does not make it impossible for people to get it from the tarball and/or complain that they wanted to install but got a generic Drupal / composer message. This is the only way to give specific actionable guidance to people who try to use it on the wrong Drupal major version.

mmjvb’s picture

My bad. Was convinced it was wrong, but I stand corrected. Thanks and sorry for the inconvenience.

gábor hojtsy’s picture

It's fine, thanks for reporting the original problem :)

terismikilis’s picture

I had the same problem, but now installing it without problem! thanks for fixing it! :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.