Page MenuHomePhabricator

Composer issue witth phpspec/prophecy and PHP 8.1
Closed, InvalidPublic

Description

I've been running MediaWiki under PHP 8.1 for a while and for numerous reasons I want to downgrade to 7.4. I've tried switchin the version of PHP and this works, but MediaWiki then throws a dependency error for composer, citing that some require PHP 8.1 or above.

To debug this, I've composer depends php | grep 8.1 and it yields, phpspec/prophecy v1.17.0 requires php (^7.2 || 8.0.* || 8.1.* || 8.2.*), which seems to be the package causing the issue—I think. I can't figure out how to remove this and require a version of this dependency that works with 7.4.

I've tried deleting the vendor folder, and also the composer.lock folder, and then switching to PHP 7.4, and running composer install, composer update, neither of which solve the issue and it is the same dependency which keeps reappearing when grepping.

Anyone any ideas what is happening here? And how I can force a version of phpsec/prophecy?

Event Timeline

Hi, has this been brought up in a support venue before, as this sounds like a question how to do something and not like a bug report?

It's helpful if you post the actual error.

To debug this, I've composer depends php | grep 8.1 and it yields, phpspec/prophecy v1.17.0 requires php (^7.2 || 8.0.* || 8.1.* || 8.2.*), which seems to be the package causing the issue—I think. I can't figure out how to remove this and require a version of this dependency that works with 7.4.

^7.2 would include 7.4, upto anything less than 8.0. So I imagine that what you actually thing is the error, probably isn't the error.

See https://getcomposer.org/doc/articles/versions.md#caret-version-range-

Is composer actually running on PHP 7.4?

And do you actually need phpspec/prophecy? It's a dev dependancy...

OriginalAuthority claimed this task.

It's helpful if you post the actual error.

To debug this, I've composer depends php | grep 8.1 and it yields, phpspec/prophecy v1.17.0 requires php (^7.2 || 8.0.* || 8.1.* || 8.2.*), which seems to be the package causing the issue—I think. I can't figure out how to remove this and require a version of this dependency that works with 7.4.

^7.2 would include 7.4, upto anything less than 8.0. So I imagine that what you actually thing is the error, probably isn't the error.

See https://getcomposer.org/doc/articles/versions.md#caret-version-range-

Is composer actually running on PHP 7.4?

And do you actually need phpspec/prophecy? It's a dev dependancy...

Thank you, this actually helped. Turned out it wasn't MediaWiki composer throwing the issue (that was correctly installing at 7.4), but it was OAuth's vendor file that was the issue. Deleted that and reinstalled and it works now.

Aklapper changed the task status from Resolved to Invalid.Jun 20 2023, 1:41 PM
Aklapper removed OriginalAuthority as the assignee of this task.