Skip to content

Unable to render page when 'meta title' page config param is set #2956

Closed
@OlegIvan0v

Description

@OlegIvan0v

Preconditions

  1. Magento 2

Steps to reproduce

  1. Create a custom module with following controller:
use Magento\Framework\View\Result\PageFactory;

class SomeAction extends \Magento\Framework\App\Action\Action
{
    /**
     * @var PageFactory
     */
    protected $resultPageFactory;

    public function __construct(
        Context $context,
        PageFactory $resultPageFactory
    ) {
        parent::__construct($context);
        $this->resultPageFactory = $resultPageFactory;
    }

    public function execute()
    {
        /** $resultPage @var \Magento\Framework\View\Result\Page */
        $resultPage = $this->resultPageFactory->create();
        $resultPage->getConfig()->setMetadata('title', 'some meta title');
        return $resultPage;
    }
}
  1. Open the created controller on storefront.

Expected result

Page is opened, its source contains <meta name="title" content="some meta title">

Actulal result

Error message: "Recoverable Error: Object of class Magento\Framework\View\Page\Title could not be converted to string..."

Additional info: the reason in that page config renderer tries to use page title object as meta title content (in \Magento\Framework\View\Page\Config\Renderer::processMetadataContent()).

Metadata

Metadata

Assignees

Labels

Area: FrontendFixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions