Closed scottgruber closed 2 years ago
Same issue here, running CraftCMS locally with Laravel Homestead. I downgraded to PHP 8.0 and warning disappear.
Ask them to upgrade to a newer version of phpdotenv. :)
~I downgraded too and that resolved fixed the issue for the moment, although I dropped down to php7.4. Too close to the holidays to worry about it.~
~valet use php@7.4
~
~composer global update
~
~valet restart
~
EDIT FROM MAINTAINER: DO NOT DO THIS. Do not downgrade PHP to "fix" issues with this package - the real problem is that you mistakenly installed an old version of this package - a common mistake is writing 5.0
instead of ^5.0
- check your composer.json
file.
Fixed.
~Install a compatible php version with brew install php@7.4
~
~and use it by running~
~Brew link php@7.4
~
EDIT FROM MAINTAINER: DO NOT DO THIS. Do not downgrade PHP to "fix" issues with this package - the real problem is that you mistakenly installed an old version of this package - a common mistake is writing 5.0
instead of ^5.0
- check your composer.json
file.
Install a compatible php version with
brew install php@7.4
and use it by running
Brew link php@7.4
THE ABOVE IS FOR MAC USERS
@Tsdjimmy that is not good advice. You need to instead upgrade to the latest phpdotenv version in the major series you are using. The latest 2.x, 3.x, 4.x and 5.x releases all run on PHP 8.1 without this error.
scottgruber thanks!!
@selenearzola I re-iterate: it is not a good idea to use out of date software. The latest version of each 2.x, 3.x, 4.x and 5.x series package is tested on, and known to work with the latest version of PHP. Do not downgrade PHP to "fix" issues with this package - the real problem is that you mistakenly installed an old version of this package - a common mistake is writing 5.0
instead of ^5.0
- check your composer.json
file.
Hi,
I came across an error after updating to PHP 8.1 while loading a via CraftCMS site locally. The same error also happened using PHP8.0.
PHPWatch posted a new PHP8.1 attribute
New #[ReturnTypeWillChange] attribute
which may solve the issue.Here is the error.
Before
After
As a quick test, I took a look in AbstractVariables.php and added
#[\ReturnTypeWillChange]
before the public function declaration and the warning was suppressed. I read your contributing guidelines, and could try to make the changes and submit a PR, but I'm a junior PHP developer and might not code it correctly.