Description
Preconditions (*)
- Magento 2.3.x & 2.3-develop
- PHP 7.2.21 (i believe any other version too).
Steps to reproduce (*)
-
Enable standard RSS Feed module.
-
Choose any channel.(New product in my case)
-
Refresh of site will make RSS Feed work. The point is that it's not working every time after compile.
Expected result (*)
- Module should output XML file
Actual result (*)
1 exception(s):
Exception #0 (Zend\Feed\Writer\Exception\InvalidArgumentException): Invalid parameter: parameter must be a non-empty string
What i found (*)
I debugged it and in Zend\Feed\Writer\AbstractFeed in method setTitle there is condition:
if ((empty($title) && ! is_numeric($title)) || ! is_string($title)) { throw new Exception\InvalidArgumentException('Invalid parameter: parameter must be a non-empty string'); }
$title is an instance of 'Magento\Framework\Phrase' that is why it's throwing an exception.
When i changed the condition to:
if ((empty($title) && ! is_numeric($title)) || (! is_string($title) && strpos(get_class($title), 'Magento\Framework\Phrase') === false)) {
I tried this way just temporary for tests but it will require to modify data before it will reach Zend's library method.