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

Embeds in RichText are rendered as literal HTML in some setups

    Details

    • Type: Bug Bug
    • Status: Backlog
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.4.0-rc1, 1.6.1
    • Fix Version/s: None
    • Component/s: Field types
    • Labels:
      None
    • Environment:

      Mac OS
      PHP 7
      libxml Version => 2.9.3
      libxslt Version => 1.1.28

      Description

      With PHP 7.0.6 installed via homebrew on mac os, with the libxslt/libxml versions described in environment, embeds are htmlentities encoded, and rendered as literal HTML.

      It has been reproduced on two PHP 7 installations on mac os, with the same result.

        Issue Links

          Activity

          Hide
          Io Sol Inf added a comment -

          Reproduced with php 5.5 and php 5.6 (built with homebrew as well)

          Show
          Io Sol Inf added a comment - Reproduced with php 5.5 and php 5.6 (built with homebrew as well)
          Hide
          Io Sol Inf added a comment - - edited

          I cannot tell what implication this workaround / fix will have, but I've verified that
          in ezpublish-kernel/eZ/Bundle/EzPublishDebugBundle/Twig/DebugTemplate.php, if
          $templateResult = ob_get_clean(); is changed to
          $templateResult = html_entity_decode( ob_get_clean() );, the image renders properly (while in DEV mode)

          Might this be considered a valid fix? That being the case I would be happy to create a PR

          (Found this on stackoverflow: http://stackoverflow.com/questions/10062780/preserving-html-entities-with-libxml)

          Show
          Io Sol Inf added a comment - - edited I cannot tell what implication this workaround / fix will have, but I've verified that in ezpublish-kernel/eZ/Bundle/EzPublishDebugBundle/Twig/DebugTemplate.php , if $templateResult = ob_get_clean(); is changed to $templateResult = html_entity_decode( ob_get_clean() ); , the image renders properly (while in DEV mode) Might this be considered a valid fix? That being the case I would be happy to create a PR (Found this on stackoverflow: http://stackoverflow.com/questions/10062780/preserving-html-entities-with-libxml )
          Hide
          Io Sol Inf added a comment -

          I've been trying to identify where to fix the issue for PROD environment, so far without success. But since I only use OSX for DEV, I've adapted the above workaround in my local installation for the time being.

          Show
          Io Sol Inf added a comment - I've been trying to identify where to fix the issue for PROD environment, so far without success. But since I only use OSX for DEV, I've adapted the above workaround in my local installation for the time being.
          Hide
          Philipp Bohnenstengel added a comment -

          is there any update on this?

          for the time being I created this jquery helper which I can run in browser dev tools but a real fix would be appreciated

          $(".ezrichtext-field").contents().filter(function(){return this.nodeType === 3 && $.trim(this.nodeValue) !== '';}).each(function(){$(this).replaceWith(this.textContent)});
          

          Show
          Philipp Bohnenstengel added a comment - is there any update on this? for the time being I created this jquery helper which I can run in browser dev tools but a real fix would be appreciated $( ".ezrichtext-field" ).contents().filter( function (){ return this .nodeType === 3 && $.trim( this .nodeValue) !== '' ;}).each( function (){$( this ).replaceWith( this .textContent)});
          Hide
          André Rømcke added a comment - - edited

          Io Sol Inf If several can confirm the fix and with no side effects for others we are happy to accept a PR. Make sure to yo add inline comment on why it is done like that

          Show
          André Rømcke added a comment - - edited Io Sol Inf If several can confirm the fix and with no side effects for others we are happy to accept a PR. Make sure to yo add inline comment on why it is done like that
          Hide
          Io Sol Inf added a comment -

          André Rømcke, I don't thibnk that my hack can be applied in production. If I recall correctly, it solved the issue in DEV but it seems to much "hackish" to be applied in PROD.
          I'll check if the issue still exists with the latest eZPlatform / OSX updates.

          Show
          Io Sol Inf added a comment - André Rømcke , I don't thibnk that my hack can be applied in production. If I recall correctly, it solved the issue in DEV but it seems to much "hackish" to be applied in PROD. I'll check if the issue still exists with the latest eZPlatform / OSX updates.
          Hide
          Bertrand Dunogier added a comment -

          It still exists on eZ Platform 1.9.0-rc1, at least. And the fix you have suggested still works.
          Note that your fix doesn't apply to the prod environment, as the DebugTemplate class is only used in prod. The annoying part is that it only affects some setups, not all.

          Show
          Bertrand Dunogier added a comment - It still exists on eZ Platform 1.9.0-rc1, at least. And the fix you have suggested still works. Note that your fix doesn't apply to the prod environment, as the DebugTemplate class is only used in prod. The annoying part is that it only affects some setups, not all.
          Hide
          Jani Tarvainen added a comment -

          I continued to experience this issue with PHP 7.1.4 package from Brew on Mac OS X (10.11.16). I tried a few different things to try to update the package to use a newer libxml2/libxslt versions, but didn't get it to work it. For now me the easiest solution was to replace the Brew PHP package with the LIIP one from https://php-osx.liip.ch.

          Version details, etc. here: http://share.ez.no/forums/ez-platform/ez-platform-image-embed-output-escaped-on-macos-os-x/(offset)/last

          Show
          Jani Tarvainen added a comment - I continued to experience this issue with PHP 7.1.4 package from Brew on Mac OS X (10.11.16). I tried a few different things to try to update the package to use a newer libxml2/libxslt versions, but didn't get it to work it. For now me the easiest solution was to replace the Brew PHP package with the LIIP one from https://php-osx.liip.ch . Version details, etc. here: http://share.ez.no/forums/ez-platform/ez-platform-image-embed-output-escaped-on-macos-os-x/(offset)/last

            People

            • Assignee:
              Unassigned
              Reporter:
              Bertrand Dunogier
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: