cancel
Showing results for 
Search instead for 
Did you mean: 

Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Message.

Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Message.

I am trying to upgrade Magento 2.4.3 Adobe Cloud version to 2.4.4 and I was successfully update the composer.json with necessary changes. Also I was able to run the di:compile command successfully. Now when I am trying to access my website I am getting this error

Fatal error: Cannot use ::class with dynamic class name in /var/www/html/vendor/laminas/laminas-mail/src/Message.php on line 394

Does anyone faced same issue?

5 REPLIES 5

Re: Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Mess

I have the exact same error and I will let you know if I am able to fix it.

Re: Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Mess

Hi @elvin16 , @BruceGemberling ,

 

Not sure about this but you can try below steps.

It may be solve your issue or may be some other meaningful error that will help us to resolve issue.

 

Rename vendor to vendor_bkp

Rename composer.lock to composer.lock_bkp

Execute composer install command from magento root

 

Problem Solved? Accept as Solution!

 

Hope it helps!

Thanks

Ankit Jasani

Re: Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Mess

Fatal error: Cannot use ::class with dynamic class name in vendor/laminas/laminas-mail/src/Message.php on line 394

 

i have same error please give solution for it

Re: Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Mess

Same issue after upgrading from 2.4.4 to 2.4.5. Any solution is appreciated.

Re: Fatal error: Cannot use ::class with dynamic class name in /vendor/laminas/laminas-mail/src/Mess

The problem connected to the PHP version in CLI (terminal). PHP version must be 8.X, but not 7.X. Error goes away if PHP version changed.