{"action":"created","issue":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1208","labels_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1208/labels{/name}","comments_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1208/comments","events_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1208/events","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1208","id":59497803,"number":1208,"title":"Fix EZP-21721: Displaying an empty XMLText field outputs eZXML","user":{"login":"pspanja","id":1135425,"avatar_url":"https://avatars.githubusercontent.com/u/1135425?v=3","gravatar_id":"","url":"https://api.github.com/users/pspanja","html_url":"https://github.com/pspanja","followers_url":"https://api.github.com/users/pspanja/followers","following_url":"https://api.github.com/users/pspanja/following{/other_user}","gists_url":"https://api.github.com/users/pspanja/gists{/gist_id}","starred_url":"https://api.github.com/users/pspanja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pspanja/subscriptions","organizations_url":"https://api.github.com/users/pspanja/orgs","repos_url":"https://api.github.com/users/pspanja/repos","events_url":"https://api.github.com/users/pspanja/events{/privacy}","received_events_url":"https://api.github.com/users/pspanja/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/labels/Ready%20for%20review","name":"Ready for review","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-02T15:40:58Z","updated_at":"2015-03-03T11:21:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/pulls/1208","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1208","diff_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1208.diff","patch_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1208.patch"},"body":"This PR resolves https://jira.ez.no/browse/EZP-21721\r\n\r\nOriginally reported problem was about empty XmlText field being rendered as empty internal XML format, ie:\r\n\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<section xmlns:image=\"http://ez.no/namespaces/ezpublish3/image/\" xmlns:xhtml=\"http://ez.no/namespaces/ezpublish3/xhtml/\" xmlns:custom=\"http://ez.no/namespaces/ezpublish3/custom/\"/>\r\n```\r\n\r\nThe problem was coming from `simple_block_field` and `simple_inline_field` blocks, where Twig's `default` filter was incorrectly used for a case when variable was not defined.\r\nThis filter returns passed default value if tested value is [not defined **or empty**](http://twig.sensiolabs.org/doc/filters/default.html). That could not work correctly as what is considered empty by Twig could be a correct result of processing of the field value (in this particular case with `xmltext_to_html5` filter, returning `null` for empty XmlText value).\r\n\r\nThe problem is fixed by replacing `default` filter with explicit check that a variable is not defined."},"comment":{"url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/comments/76928167","html_url":"https://github.com/ezsystems/ezpublish-kernel/pull/1208#issuecomment-76928167","issue_url":"https://api.github.com/repos/ezsystems/ezpublish-kernel/issues/1208","id":76928167,"user":{"login":"andrerom","id":289757,"avatar_url":"https://avatars.githubusercontent.com/u/289757?v=3","gravatar_id":"","url":"https://api.github.com/users/andrerom","html_url":"https://github.com/andrerom","followers_url":"https://api.github.com/users/andrerom/followers","following_url":"https://api.github.com/users/andrerom/following{/other_user}","gists_url":"https://api.github.com/users/andrerom/gists{/gist_id}","starred_url":"https://api.github.com/users/andrerom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrerom/subscriptions","organizations_url":"https://api.github.com/users/andrerom/orgs","repos_url":"https://api.github.com/users/andrerom/repos","events_url":"https://api.github.com/users/andrerom/events{/privacy}","received_events_url":"https://api.github.com/users/andrerom/received_events","type":"User","site_admin":false},"created_at":"2015-03-03T11:21:11Z","updated_at":"2015-03-03T11:21:11Z","body":"+1"}}