Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-29519

ContentProxy::__toString() must not throw an exception error

    XMLWordPrintable

Details

    Description

      The customer got an exception when using ContentProxy object in the Twig template like above:

      {{ render( controller( "ez_content:viewAction", {
        "locationId": someLocationId,
        "viewType": "sidebar",
        "params": {
          'currentContent': content
        }
      } ) ) }}
      

      Exception:

      Error: Method eZ\Publish\Core\Repository\Values\Content\ContentProxy::__toString() must not throw an exception, caught Symfony\Component\Debug\Exception\ContextErrorException: Catchable Fatal Error: Object of class eZ\Publish\Core\Repository\Values\Content\Content could not be converted to string
      

      The customer mentioned also that when they refactored template like this:

      {{ render( controller( "ez_content:viewAction", {
        "locationId": someLocationId,
        "viewType": "sidebar",
        "params": {
          'currentContentId': content.id
        }
      } ) ) }}
      

      then issue doesn't appear anymore.

      This issue has been discovered and reported by the customer during the migration to v2. Since the customer doesn't have this issue anymore it is not reported on the 3rd line but as a regular bug instead.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kamil.madejski@ibexa.co Kamil Madejski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: