cancel
Showing results for 
Search instead for 
Did you mean: 

TypeError: get_parent_class(): Argument #1 ($object_or_class)

TypeError: get_parent_class(): Argument #1 ($object_or_class)

Can anybody explain to me why this cause this error and how can i fix it. Thank for your help

TypeError: get_parent_class(): Argument #1 ($object_or_class) must be an object or a valid class name, string given in /var/www/html/rakuten_magento/vendor/magento/framework/Code/Reader/ClassReader.php:98
Stack trace:
#0 /var/www/html/rakuten_magento/vendor/magento/framework/Code/Reader/ClassReader.php(98): get_parent_class()
#1 /var/www/html/rakuten_magento/vendor/magento/framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php(142): Magento\Framework\Code\Reader\ClassReader->getParents()
#2 /var/www/html/rakuten_magento/vendor/magento/framework/View/Element/UiComponent/Argument/Interpreter/ConfigurableObject.php(120): Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject->getParents()
#3 /var/www/html/rakuten_magento/generated/code/Magento/Framework/Data/Argument/InterpreterInterface/Proxy.php(95): Magento\Framework\View\Element\UiComponent\Argument\Interpreter\ConfigurableObject->evaluate()
#4 /var/www/html/rakuten_magento/vendor/magento/framework/Data/Argument/Interpreter/Composite.php(61): Magento\Framework\Data\Argument\InterpreterInterface\Proxy->evaluate()
#5 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(164): Magento\Framework\Data\Argument\Interpreter\Composite->evaluate()
#6 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(167): Magento\Ui\Config\Data->evaluateComponentArguments()
#7 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(167): Magento\Ui\Config\Data->evaluateComponentArguments()
#8 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(167): Magento\Ui\Config\Data->evaluateComponentArguments()
#9 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(111): Magento\Ui\Config\Data->evaluateComponentArguments()
#10 /var/www/html/rakuten_magento/vendor/magento/module-ui/Config/Data.php(136): Magento\Ui\Config\Data->initData()
#11 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/Reader/UiComponent.php(100): Magento\Ui\Config\Data->get()
#12 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/ReaderPool.php(105): Magento\Framework\View\Layout\Reader\UiComponent->interpret()
#13 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/Reader/Container.php(84): Magento\Framework\View\Layout\ReaderPool->interpret()
#14 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/ReaderPool.php(105): Magento\Framework\View\Layout\Reader\Container->interpret()
#15 /var/www/html/rakuten_magento/vendor/magento/framework/View/Page/Config/Reader/Body.php(68): Magento\Framework\View\Layout\ReaderPool->interpret()
#16 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/ReaderPool.php(105): Magento\Framework\View\Page\Config\Reader\Body->interpret()
#17 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout.php(346): Magento\Framework\View\Layout\ReaderPool->interpret()
#18 /var/www/html/rakuten_magento/generated/code/Magento/Framework/View/Layout/Interceptor.php(32): Magento\Framework\View\Layout->generateElements()
#19 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#20 /var/www/html/rakuten_magento/vendor/magento/framework/View/Page/Builder.php(65): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#21 /var/www/html/rakuten_magento/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Page\Builder->generateLayoutBlocks()
#22 /var/www/html/rakuten_magento/vendor/magento/framework/View/Page/Config.php(227): Magento\Framework\View\Layout\Builder->build()
#23 /var/www/html/rakuten_magento/vendor/magento/framework/View/Page/Config.php(250): Magento\Framework\View\Page\Config->build()
#24 /var/www/html/rakuten_magento/app/code/Rakuten/MemberCard/Controller/Adminhtml/Card/Import.php(21): Magento\Framework\View\Page\Config->getTitle()
#25 /var/www/html/rakuten_magento/vendor/magento/framework/App/Action/Action.php(111): Rakuten\MemberCard\Controller\Adminhtml\Card\Import->execute()
#26 /var/www/html/rakuten_magento/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#27 /var/www/html/rakuten_magento/vendor/magento/framework/App/FrontController.php(245): Magento\Backend\App\AbstractAction->dispatch()
#28 /var/www/html/rakuten_magento/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#29 /var/www/html/rakuten_magento/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#30 /var/www/html/rakuten_magento/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#31 /var/www/html/rakuten_magento/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#32 /var/www/html/rakuten_magento/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}()
#33 /var/www/html/rakuten_magento/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#34 /var/www/html/rakuten_magento/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#35 /var/www/html/rakuten_magento/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#36 /var/www/html/rakuten_magento/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#37 {main}
1 REPLY 1

Re: TypeError: get_parent_class(): Argument #1 ($object_or_class)

Hello @annq3sivn4281 

 

In reality, get_parent_class() does accept a string and this hasn't changed in php 8. The important part of the error is 'valid class name', not 'string given'. This had me stumped for a good hour or more thinking the issue was php 8 when in fact it was a class name typo. It would be great if a better error could be generated by checking for the existence of a class before passing it to get_parent_class() or something. It's a fatal error so I'm not sure anything could be done after the error to catch and improve the message.

Problem solved? Click Accept as Solution!