I'm trying to open the product detail page from the listing page but its not working, and its showing the below error:

2 exception(s):
Exception #0 (Magento\Framework\Exception\LocalizedException): Invalid block type: Magento\Review\Block\Product\Review
Exception #1 (ReflectionException): Class Magento\Review\Block\Product\Review does not exist

Can anyone please help me to rectify this error?

When I try to open the product page, its not opening and I can see the below error in view-source:

<meta property="og:type" content="product" />
<meta property="og:title" content="<br />
<b>Fatal error</b>:  Uncaught Error: Call to a member function getName() on null in /var/www/html/vendor/magento/module-catalog/view/frontend/templates/product/view/opengraph/general.phtml:13
Stack trace:
#0 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include()
#1 /var/www/html/vendor/magento/framework/View/Element/Template.php(271): Magento\Framework\View\TemplateEngine\Php-&gt;render(Object(vendor\module\Block\Index\Index), '/var/www/html/v...', Array)
#2 /var/www/html/vendor/magento/framework/View/Element/Template.php(301): Magento\Framework\View\Element\Template-&gt;fetchView('/var/www/html/v...')
#3 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1094): Magento\Framework\View\Element\Template-&gt;_toHtml()
#4 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(1098): Magento\Framework\View\Element\AbstractBlock-&gt;Magento\Framework\View\Element\{closure}()
#5 /var/www/html/vendor/magento/framework/View/Element/AbstractBlock.php(671): Magento\Framework\View\Element\Abst in <b>/var/www/html/vendor/magento/module-catalog/view/frontend/templates/product/view/opengraph/general.phtml</b> on line <b>13</b><br />
  • did you check the logs/report? Mar 3, 2020 at 9:02

3 Answers 3


try to run the command to re generate class

sudo php bin/magento setup:di:compile

  • I have done that but still its showing the error
    – MagentoDev
    Mar 3, 2020 at 6:23

Check the constructor. Problem is with the Constructor params . After fixing it run di:compile


Check Whether Magento\Review\Block\Product\Review is overridden. If so, then cross check the block extends type.

Also, check the catalog_product_view.xml file whether the review block class is mentioned correctly as

<block class="Magento\Review\Block\Product\Review" name="reviews.tab" as="reviews" template="Magento_Review::review.phtml" group="detailed_info" ifconfig="catalog/review/active">

If everything is correctly, Please follow below steps

1) rm -rf var/* pub/static/* generated/* (to remove all cache, static content and generated files)

2) php bin/magento setup:upgrade && php bin/magento setup:di:compile && php bin/magento setup:static-content:deploy -f

Note: Use -f if you are in developer mode.

  • I have updated the question, please check @Sathishkumar
    – MagentoDev
    Mar 3, 2020 at 10:27
  • @Siva, I noticed the product name itself not getting and throwing an error. Have you done any migration of DB. Also, check the admin panel whether the product is available. If so, try to edit and save it. Mar 3, 2020 at 13:48

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.