Magento 2 does not strip the HTML tags while using the current product's description as the current HTML page's meta description (if the product does not have a dedicated meta description) (and my fix)

The problem line is:

To fix the issue replace it with the new one:

$this->pageConfig->setDescription($this->string->substr(strip_tags($product->getDescription()), 0, 255));

This doesnt seem to be working on 2.0.2, its giving me a 500 server error. Any ideas?

You should learn how to diagnose the “50x” errors: it is a very basic skill for a PHP developer, and it is not related to the particular problem: How to diagnose Magento 2 errors

im not a php developer… Just a guy trying to fix his site lol. I have the problem described here. And when I apply the fix you posted it gives a 500 error. I found my entire directory structure different than your example. Maybe because it is 2.0.2? Found in following location

/html/vendor/magento/module-catalog/Block/Product/view.php

Im not looking for handouts man, if ya can help me out ill send ya a few bucks.

Thanks
Mike

I have no “few bucks” support plan, but I recommend to implement Advices 2 and 3 from the instruction I linked in the previous message. It will help you to get the actual error message instead of a generic 500 code.

Thank you! worked like a charm!

See also: