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

RichText field does not accept html5edit input with HTML entities

    Details

      Description

      Like   or " which are quite common when using a WYSIWYG editor but actually it should be possible to use any HTML entity.

      Step to reproduce: https://github.com/dpobel/TestCommandsBundle/blob/master/Command/CreateRichTextEntitiesCommand.php

        Issue Links

          Activity

          Hide
          Rui Silva (Inactive) added a comment -

          Tested and approved by QA for master.

          Show
          Rui Silva (Inactive) added a comment - Tested and approved by QA for master.
          Hide
          Damien Pobel (Inactive) added a comment - - edited

          Reopening because this was actually hidden by a bug in PlatformUI. The following curl command allows to reproduce the issue:

          curl 'http://ez.loc/api/ezp/v2/content/objects' -H 'X-CSRF-Token: r6LpxwMcsXNMck_sdGGmym2GeV0RB75IH6GI0TTBslk' \
          -H 'Content-Type: application/vnd.ez.api.ContentCreate+json' \
          -H 'Accept: application/vnd.ez.api.Content+json' \
          -H 'Cookie: is_logged_in=true; privacyCookieAccepted=1; eZSESSID=oi1ikoj6n4hurhok2bcakb8oo7' \
          --data-binary '{"ContentCreate":{"ContentType":{"_href":"/api/ezp/v2/content/types/18"},"mainLanguageCode":"eng-GB","LocationCreate":{"ParentLocation":{"_href":"/api/ezp/v2/content/locations/1/2/90"},"sortField":"PATH","sortOrder":"ASC"},"Section":null,"alwaysAvailable":false,"remoteId":null,"modificationDate":"2015-11-30T14:57:28.374Z","fields":{"field":[{"fieldDefinitionIdentifier":"title","fieldValue":"Test"},{"fieldDefinitionIdentifier":"body","fieldValue":{"xml":"<section xmlns=\"http://ez.no/namespaces/ezpublish5/xhtml5/edit\"><p>&nbsp;</p></section>"}},{"fieldDefinitionIdentifier":"publication_date","fieldValue":{"timestamp":1448893263}},{"fieldDefinitionIdentifier":"tags","fieldValue":[]}]}}}'
          

          {
              "ErrorMessage": {
                  "_media-type": "application\/vnd.ez.api.ErrorMessage+json",
                  "errorCode": 406,
                  "errorMessage": "Not Acceptable",
                  "errorDescription": "Argument '$inputValue' is invalid: Could not create XML document: Entity 'nbsp' not defined",
                  "trace": "#0 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php(167): eZ\\Publish\\Core\\FieldType\\RichText\\Type->loadXMLString('<section xmlns=...')\n#1 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/FieldType.php(383): eZ\\Publish\\Core\\FieldType\\RichText\\Type->createValueFromInput('<section xmlns=...')\n#2 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php(303): eZ\\Publish\\Core\\FieldType\\FieldType->acceptValue('<section xmlns=...')\n#3 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/Repository\/Values\/ContentType\/FieldType.php(191): eZ\\Publish\\Core\\FieldType\\RichText\\Type->fromHash(Array)\n#4 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/FieldTypeParser.php(96): eZ\\Publish\\Core\\Repository\\Values\\ContentType\\FieldType->fromHash(Array)\n#5 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Server\/Input\/Parser\/ContentCreate.php(169): eZ\\Publish\\Core\\REST\\Common\\Input\\FieldTypeParser->parseValue('ezrichtext', Array)\n#6 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/ParsingDispatcher.php(83): eZ\\Publish\\Core\\REST\\Server\\Input\\Parser\\ContentCreate->parse(Array, Object(eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher))\n#7 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/Dispatcher.php(117): eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher->parse(Array, 'application\/vnd...')\n#8 \/home\/dp\/dev\/PlatformUIBundle\/Controller\/Rest\/ContentController.php(116): eZ\\Publish\\Core\\REST\\Common\\Input\\Dispatcher->parse(Object(eZ\\Publish\\Core\\REST\\Common\\Message))\n#9 \/home\/dp\/dev\/PlatformUIBundle\/Controller\/Rest\/ContentController.php(32): EzSystems\\PlatformUIBundle\\Controller\\Rest\\ContentController->isUserCreateRequest(Object(Symfony\\Component\\HttpFoundation\\Request))\n#10 [internal function]: EzSystems\\PlatformUIBundle\\Controller\\Rest\\ContentController->createContent(Object(Symfony\\Component\\HttpFoundation\\Request))\n#11 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(147): call_user_func_array(Array, Array)\n#12 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(68): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#13 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/DependencyInjection\/ContainerAwareHttpKernel.php(69): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#14 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/Kernel.php(196): Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#15 \/home\/dp\/dev\/ezplatform\/web\/index.php(66): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#16 {main}",
                  "file": "\/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php",
                  "line": 218
              }
          }
          

          Show
          Damien Pobel (Inactive) added a comment - - edited Reopening because this was actually hidden by a bug in PlatformUI. The following curl command allows to reproduce the issue: curl 'http://ez.loc/api/ezp/v2/content/objects' -H 'X-CSRF-Token: r6LpxwMcsXNMck_sdGGmym2GeV0RB75IH6GI0TTBslk' \ -H 'Content-Type: application/vnd.ez.api.ContentCreate+json' \ -H 'Accept: application/vnd.ez.api.Content+json' \ -H 'Cookie: is_logged_in=true; privacyCookieAccepted=1; eZSESSID=oi1ikoj6n4hurhok2bcakb8oo7' \ --data-binary '{"ContentCreate":{"ContentType":{"_href":"/api/ezp/v2/content/types/18"},"mainLanguageCode":"eng-GB","LocationCreate":{"ParentLocation":{"_href":"/api/ezp/v2/content/locations/1/2/90"},"sortField":"PATH","sortOrder":"ASC"},"Section":null,"alwaysAvailable":false,"remoteId":null,"modificationDate":"2015-11-30T14:57:28.374Z","fields":{"field":[{"fieldDefinitionIdentifier":"title","fieldValue":"Test"},{"fieldDefinitionIdentifier":"body","fieldValue":{"xml":"<section xmlns=\"http://ez.no/namespaces/ezpublish5/xhtml5/edit\"><p>&nbsp;</p></section>"}},{"fieldDefinitionIdentifier":"publication_date","fieldValue":{"timestamp":1448893263}},{"fieldDefinitionIdentifier":"tags","fieldValue":[]}]}}}' { "ErrorMessage": { "_media-type": "application\/vnd.ez.api.ErrorMessage+json", "errorCode": 406, "errorMessage": "Not Acceptable", "errorDescription": "Argument '$inputValue' is invalid: Could not create XML document: Entity 'nbsp' not defined", "trace": "#0 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php(167): eZ\\Publish\\Core\\FieldType\\RichText\\Type->loadXMLString('<section xmlns=...')\n#1 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/FieldType.php(383): eZ\\Publish\\Core\\FieldType\\RichText\\Type->createValueFromInput('<section xmlns=...')\n#2 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php(303): eZ\\Publish\\Core\\FieldType\\FieldType->acceptValue('<section xmlns=...')\n#3 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/Repository\/Values\/ContentType\/FieldType.php(191): eZ\\Publish\\Core\\FieldType\\RichText\\Type->fromHash(Array)\n#4 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/FieldTypeParser.php(96): eZ\\Publish\\Core\\Repository\\Values\\ContentType\\FieldType->fromHash(Array)\n#5 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Server\/Input\/Parser\/ContentCreate.php(169): eZ\\Publish\\Core\\REST\\Common\\Input\\FieldTypeParser->parseValue('ezrichtext', Array)\n#6 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/ParsingDispatcher.php(83): eZ\\Publish\\Core\\REST\\Server\\Input\\Parser\\ContentCreate->parse(Array, Object(eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher))\n#7 \/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/REST\/Common\/Input\/Dispatcher.php(117): eZ\\Publish\\Core\\REST\\Common\\Input\\ParsingDispatcher->parse(Array, 'application\/vnd...')\n#8 \/home\/dp\/dev\/PlatformUIBundle\/Controller\/Rest\/ContentController.php(116): eZ\\Publish\\Core\\REST\\Common\\Input\\Dispatcher->parse(Object(eZ\\Publish\\Core\\REST\\Common\\Message))\n#9 \/home\/dp\/dev\/PlatformUIBundle\/Controller\/Rest\/ContentController.php(32): EzSystems\\PlatformUIBundle\\Controller\\Rest\\ContentController->isUserCreateRequest(Object(Symfony\\Component\\HttpFoundation\\Request))\n#10 [internal function]: EzSystems\\PlatformUIBundle\\Controller\\Rest\\ContentController->createContent(Object(Symfony\\Component\\HttpFoundation\\Request))\n#11 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(147): call_user_func_array(Array, Array)\n#12 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/HttpKernel.php(68): Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object(Symfony\\Component\\HttpFoundation\\Request), 1)\n#13 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/DependencyInjection\/ContainerAwareHttpKernel.php(69): Symfony\\Component\\HttpKernel\\HttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#14 \/home\/dp\/dev\/ezplatform\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/HttpKernel\/Kernel.php(196): Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request), 1, true)\n#15 \/home\/dp\/dev\/ezplatform\/web\/index.php(66): Symfony\\Component\\HttpKernel\\Kernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#16 {main}", "file": "\/home\/dp\/dev\/ezpublish-kernel\/eZ\/Publish\/Core\/FieldType\/RichText\/Type.php", "line": 218 } }
          Hide
          Damien Pobel (Inactive) added a comment -

          Note: this is supposed to be fixed thanks to https://jira.ez.no/browse/EZP-25027

          Show
          Damien Pobel (Inactive) added a comment - Note: this is supposed to be fixed thanks to https://jira.ez.no/browse/EZP-25027
          Hide
          Bertrand Dunogier added a comment - - edited
          Show
          Bertrand Dunogier added a comment - - edited Fixed in https://github.com/ezsystems/ezpublish-kernel/pull/1529 (merged to master@80bf1d0 ).
          Hide
          Rui Silva (Inactive) added a comment -

          Tested and approved by QA for master.

          Show
          Rui Silva (Inactive) added a comment - Tested and approved by QA for master.

            People

            • Assignee:
              Unassigned
              Reporter:
              Damien Pobel (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours, 5 minutes
                7h 5m