skip to Main Content

For a while now I have been trying to find a fix for my Magento admin panel, when I want to change some settings it dosent allow me to change anything, for example, "Use system value" boxes are locked and when I hover over them I get a red circle indicating I am unable to change the value.

I found this tutorial: https://community.magento.com/t5/Magento-2-x-Technical-Issues/Unlock-configuration/m-p/95209#M5084

But when I try to run setup:di:compile, I get this error:

"Application code generator… 3/9 [=========>——————] 33% 5 secs 246.0 MiBPHP Fatal error: Uncaught TypeError: rtrim() expects parameter 1 to be string, bool given in /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php:95
Stack trace:
#0 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(95): rtrim()
#1 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(286): MagentoSetupModuleDiCodeScannerPhpScanner->getSourceClassName()
#2 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(152): MagentoSetupModuleDiCodeScannerPhpScanner->shouldGenerateClass()
#3 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(184): MagentoSetupModuleDiCodeScannerPhpScanner->_fetchMissingExtensionAttributesClasses()
#4 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ApplicationCodeGenerator.php(77): MagentoSetupModuleDiCodeScannerPhpScanner->collectEntities()
#5 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): MagentoSetupModuleDiAppT in /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php on line 95

Fatal error: Uncaught TypeError: rtrim() expects parameter 1 to be string, bool given in /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php:95
Stack trace:
#0 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(95): rtrim()
#1 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(286): MagentoSetupModuleDiCodeScannerPhpScanner->getSourceClassName()
#2 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(152): MagentoSetupModuleDiCodeScannerPhpScanner->shouldGenerateClass()
#3 /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php(184): MagentoSetupModuleDiCodeScannerPhpScanner->_fetchMissingExtensionAttributesClasses()
#4 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Operation/ApplicationCodeGenerator.php(77): MagentoSetupModuleDiCodeScannerPhpScanner->collectEntities()
#5 /var/www/html/setup/src/Magento/Setup/Module/Di/App/Task/Manager.php(56): MagentoSetupModuleDiAppT in /var/www/html/setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php on line 95"

I have tried composer install and update, but that didn’t seem to help…

My php version is 7.4.20.

Any help appreciated!

2

Answers


  1. I am facing the same issue after upgrading to Magento2.4.2-p1. I did some analysis on this and got the reason for this error.
    Actually, Magento installed some new modules like Magento_TestModuleAsyncAmqp, Magento_TestModuleExtensionAttributes etc.
    When you go to file

    app/code/Magento/TestModuleExtensionAttributes/Api/Data/FakeExtensibleTwoInterface.php

    you will see

    /**
         * test incorrect return type
         *
         * **@return int**
         */
        public function getExtensionAttributes();
    

    So, here it is asking to provide class as return type instead of @return int
    If you will add below class as return type then it should work.

    MagentoTestModuleExtensionAttributesApiDataFakeExtensibleTwoExtensionInterface|int

    Try to provide class here and then run di:compile again after clearing cache, generation etc

    Login or Signup to reply.
  2. I came across this and turned out to be an issue when you run integration tests at some point before running bin/magento setup:di:compile.

    Integration tests generate some test modules in app/code/Magento which are then picked up by the setup:di:compile command.
    enter image description here
    I fixed this by removing the Magento folder from app/code.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search