0

I am using magento version 2.4.2 and php version 7.4.3

I am trying to run the project locally, getting the below error:

Exception: Deprecated Functionality: Return type of Magento\Framework\Config\FileIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/prodmagerepo/vendor/magento/framework/Config/FileIterator.php on line 68 in /var/www/html/prodmagerepo/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 /var/www/html/prodmagerepo/vendor/magento/framework/Config/FileIterator.php(17): Magento\Framework\App\ErrorHandler->handler() #1 /var/www/html/prodmagerepo/vendor/composer/ClassLoader.php(576): include('...') #2 /var/www/html/prodmagerepo/vendor/composer/ClassLoader.php(427): Composer\Autoload\{closure}() #3 /var/www/html/prodmagerepo/vendor/magento/framework/Config/FileIteratorFactory.php(38): Composer\Autoload\ClassLoader->loadClass() #4 /var/www/html/prodmagerepo/vendor/magento/framework/Module/Dir/Reader.php(111): Magento\Framework\Config\FileIteratorFactory->create() #5 /var/www/html/prodmagerepo/vendor/magento/framework/Module/Dir/Reader.php(86): Magento\Framework\Module\Dir\Reader->getFilesIterator() #6 /var/www/html/prodmagerepo/vendor/magento/framework/App/Config/FileResolver.php(65): Magento\Framework\Module\Dir\Reader->getConfigurationFiles() #7 /var/www/html/prodmagerepo/generated/code/Magento/Framework/App/Config/FileResolver/Proxy.php(95): Magento\Framework\App\Config\FileResolver->get() #8 /var/www/html/prodmagerepo/vendor/magento/framework/Config/Reader/Filesystem.php(128): Magento\Framework\App\Config\FileResolver\Proxy->get() #9 /var/www/html/prodmagerepo/vendor/magento/framework/App/ResourceConnection/Config/Reader.php(59): Magento\Framework\Config\Reader\Filesystem->read() #10 /var/www/html/prodmagerepo/generated/code/Magento/Framework/App/ResourceConnection/Config/Reader/Proxy.php(95): Magento\Framework\App\ResourceConnection\Config\Reader->read() #11 /var/www/html/prodmagerepo/vendor/magento/framework/Config/Data/Scoped.php(119): Magento\Framework\App\ResourceConnection\Config\Reader\Proxy->read() #12 /var/www/html/prodmagerepo/vendor/magento/framework/Config/Data/Scoped.php(97): Magento\Framework\Config\Data\Scoped->_loadScopedData() #13 /var/www/html/prodmagerepo/vendor/magento/framework/App/ResourceConnection/Config.php(68): Magento\Framework\Config\Data\Scoped->get() #14 /var/www/html/prodmagerepo/generated/code/Magento/Framework/App/ResourceConnection/Config/Proxy.php(95): Magento\Framework\App\ResourceConnection\Config->getConnectionName() #15 /var/www/html/prodmagerepo/vendor/magento/framework/App/ResourceConnection.php(96): Magento\Framework\App\ResourceConnection\Config\Proxy->getConnectionName() #16 /var/www/html/prodmagerepo/vendor/magento/framework/Lock/Backend/Database.php(82): Magento\Framework\App\ResourceConnection->getConnection() #17 /var/www/html/prodmagerepo/vendor/magento/framework/Cache/LockGuardedCacheLoader.php(134): Magento\Framework\Lock\Backend\Database->lock() #18 /var/www/html/prodmagerepo/vendor/magento/module-config/App/Config/Type/System.php(281): Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() #19 /var/www/html/prodmagerepo/vendor/magento/module-config/App/Config/Type/System.php(207): Magento\Config\App\Config\Type\System->loadDefaultScopeData() #20 /var/www/html/prodmagerepo/vendor/magento/module-config/App/Config/Type/System.php(181): Magento\Config\App\Config\Type\System->getWithParts() #21 /var/www/html/prodmagerepo/vendor/magento/framework/App/Config.php(132): Magento\Config\App\Config\Type\System->get() #22 /var/www/html/prodmagerepo/vendor/magento/framework/App/Config.php(80): Magento\Framework\App\Config->get() #23 /var/www/html/prodmagerepo/vendor/magento/framework/App/Config.php(93): Magento\Framework\App\Config->getValue() #24 /var/www/html/prodmagerepo/vendor/magento/module-new-relic-reporting/Model/Config.php(94): Magento\Framework\App\Config->isSetFlag() #25 /var/www/html/prodmagerepo/vendor/magento/module-new-relic-reporting/Plugin/HttpPlugin.php(49): Magento\NewRelicReporting\Model\Config->isNewRelicEnabled() #26 /var/www/html/prodmagerepo/vendor/magento/framework/Interception/Interceptor.php(121): Magento\NewRelicReporting\Plugin\HttpPlugin->beforeCatchException() #27 /var/www/html/prodmagerepo/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Http\Interceptor->Magento\Framework\Interception\{closure}() #28 /var/www/html/prodmagerepo/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http\Interceptor->___callPlugins() #29 /var/www/html/prodmagerepo/vendor/magento/framework/App/Bootstrap.php(269): Magento\Framework\App\Http\Interceptor->catchException() #30 /var/www/html/prodmagerepo/pub/index.php(29): Magento\Framework\App\Bootstrap->run() #31 {main}

If anyone has any idea how to fix this issue, please help me.

Thanks

1 Answer 1

0

In the PHP version 8.1 we have to put the return type.

But you are using the PHP 7.4.3, this issue seems to be not Occured.

There are two possible solutions:

check the versions compatibility with the Magento version

Or you can use the lower version of the PHP

10
  • I can see PHP 7.4 is compatible with Magento 2.4.2 but still why i am getting this error?
    – Prince
    Commented Sep 27, 2023 at 12:31
  • I also checked this, before answering you, but try once with the 7.3
    – Rana Zain
    Commented Sep 27, 2023 at 12:37
  • No, it's not working with 7.3
    – Prince
    Commented Sep 27, 2023 at 12:48
  • try run composer update command
    – Rana Zain
    Commented Sep 27, 2023 at 12:50
  • Tried but same error Exception: Deprecated Functionality: Method ReflectionParameter::getClass() is deprecated in /var/www/html/prodmagerepo/vendor/magento/framework/Code/Reader/ClassReader.php on line 34
    – Prince
    Commented Sep 27, 2023 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.