{"action":"created","comment":{"url":"https://api.github.com/repos/pkp/ojs/pulls/comments/70794507","id":70794507,"diff_hunk":"@@ -84,6 +84,27 @@ function getAtomDocumentPath() {\n \t function getPackageFilePath() {\n \t\treturn $this->getDepositDir() . DIRECTORY_SEPARATOR . $this->_deposit->getUUID() . \".zip\";\n \t}\n+    \n+    /**\n+     * Create a DOMElement in the $dom, and set the element name, namespace, and \n+     * content appropriately. Named HTML entities in the content are converted\n+     * to UTF-8 characters. Any invalid UTF-8 characters will be dropped.\n+     * \n+     * @param DOMDocument $dom\n+     * @param string $elementName\n+     * @param string $content\n+     * @param string $namespace\n+     * @return DOMElement\n+     */\n+\tfunction _generateElement($dom, $elementName, $content, $namespace = null){\n+\t\t$encoded = html_entity_decode($content, ENT_NOQUOTES | ENT_HTML401, 'UTF-8');\n+\t\t$filtered = iconv('UTF-8', 'UTF-8//IGNORE', $encoded);","path":"plugins/generic/pln/classes/DepositPackage.inc.php","position":18,"original_position":18,"commit_id":"accff6ee5475625140b980179cda907b30c56d34","original_commit_id":"accff6ee5475625140b980179cda907b30c56d34","user":{"login":"ctgraham","id":7001322,"avatar_url":"https://avatars.githubusercontent.com/u/7001322?v=3","gravatar_id":"","url":"https://api.github.com/users/ctgraham","html_url":"https://github.com/ctgraham","followers_url":"https://api.github.com/users/ctgraham/followers","following_url":"https://api.github.com/users/ctgraham/following{/other_user}","gists_url":"https://api.github.com/users/ctgraham/gists{/gist_id}","starred_url":"https://api.github.com/users/ctgraham/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ctgraham/subscriptions","organizations_url":"https://api.github.com/users/ctgraham/orgs","repos_url":"https://api.github.com/users/ctgraham/repos","events_url":"https://api.github.com/users/ctgraham/events{/privacy}","received_events_url":"https://api.github.com/users/ctgraham/received_events","type":"User","site_admin":false},"body":"How about (untested):\r\n```\r\nif (html_entities($content) != $content) {\r\n  $data = $dom->createCDATASection( $content );\r\n} else {\r\n   $data = $dom->createTextNode( $content );\r\n}\r\nif ($namespace !== null ) {\r\n   $element = $dom->createElementNS($namespace, $elementName);\r\n} else {\r\n   $element = $dom->createElement($elementName);\r\n}\r\nreturn $element->appendChild($data);\r\n```","created_at":"2016-07-14T12:16:49Z","updated_at":"2016-07-14T12:16:49Z","html_url":"https://github.com/pkp/ojs/pull/924#discussion_r70794507","pull_request_url":"https://api.github.com/repos/pkp/ojs/pulls/924","_links":{"self":{"href":"https://api.github.com/repos/pkp/ojs/pulls/comments/70794507"},"html":{"href":"https://github.com/pkp/ojs/pull/924#discussion_r70794507"},"pull_request":{"href":"https://api.github.com/repos/pkp/ojs/pulls/924"}}},"pull_request":{"url":"https://api.github.com/repos/pkp/ojs/pulls/924","id":77342516,"html_url":"https://github.com/pkp/ojs/pull/924","diff_url":"https://github.com/pkp/ojs/pull/924.diff","patch_url":"https://github.com/pkp/ojs/pull/924.patch","issue_url":"https://api.github.com/repos/pkp/ojs/issues/924","number":924,"state":"open","locked":false,"title":"convert html entities to UTF-8","user":{"login":"ubermichael","id":1328893,"avatar_url":"https://avatars.githubusercontent.com/u/1328893?v=3","gravatar_id":"","url":"https://api.github.com/users/ubermichael","html_url":"https://github.com/ubermichael","followers_url":"https://api.github.com/users/ubermichael/followers","following_url":"https://api.github.com/users/ubermichael/following{/other_user}","gists_url":"https://api.github.com/users/ubermichael/gists{/gist_id}","starred_url":"https://api.github.com/users/ubermichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubermichael/subscriptions","organizations_url":"https://api.github.com/users/ubermichael/orgs","repos_url":"https://api.github.com/users/ubermichael/repos","events_url":"https://api.github.com/users/ubermichael/events{/privacy}","received_events_url":"https://api.github.com/users/ubermichael/received_events","type":"User","site_admin":false},"body":"The PLN staging server was tossing HTTP 500 errors for deposit XML that contained HTML entities like `&copy;` (which isn't well-formed XML anyway, so it's probably the right thing to do, although maybe it should be HTTP 400 since it isn't an internal error but a bad request).\r\n\r\nThis patch encodes all the metadata fields which might have entities as UTF-8, and also filters out an invalid UTF-8 sequences at the same time. \r\n\r\nFixes pkp/lib-pkp#1607\r\n\r\n","created_at":"2016-07-13T18:57:41Z","updated_at":"2016-07-14T12:16:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2a2467f9623fbf853f7dc7ddbe9482a6354bf85","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pkp/ojs/pulls/924/commits","review_comments_url":"https://api.github.com/repos/pkp/ojs/pulls/924/comments","review_comment_url":"https://api.github.com/repos/pkp/ojs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pkp/ojs/issues/924/comments","statuses_url":"https://api.github.com/repos/pkp/ojs/statuses/accff6ee5475625140b980179cda907b30c56d34","head":{"label":"ubermichael:gh-1607","ref":"gh-1607","sha":"accff6ee5475625140b980179cda907b30c56d34","user":{"login":"ubermichael","id":1328893,"avatar_url":"https://avatars.githubusercontent.com/u/1328893?v=3","gravatar_id":"","url":"https://api.github.com/users/ubermichael","html_url":"https://github.com/ubermichael","followers_url":"https://api.github.com/users/ubermichael/followers","following_url":"https://api.github.com/users/ubermichael/following{/other_user}","gists_url":"https://api.github.com/users/ubermichael/gists{/gist_id}","starred_url":"https://api.github.com/users/ubermichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubermichael/subscriptions","organizations_url":"https://api.github.com/users/ubermichael/orgs","repos_url":"https://api.github.com/users/ubermichael/repos","events_url":"https://api.github.com/users/ubermichael/events{/privacy}","received_events_url":"https://api.github.com/users/ubermichael/received_events","type":"User","site_admin":false},"repo":{"id":39470994,"name":"ojs","full_name":"ubermichael/ojs","owner":{"login":"ubermichael","id":1328893,"avatar_url":"https://avatars.githubusercontent.com/u/1328893?v=3","gravatar_id":"","url":"https://api.github.com/users/ubermichael","html_url":"https://github.com/ubermichael","followers_url":"https://api.github.com/users/ubermichael/followers","following_url":"https://api.github.com/users/ubermichael/following{/other_user}","gists_url":"https://api.github.com/users/ubermichael/gists{/gist_id}","starred_url":"https://api.github.com/users/ubermichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubermichael/subscriptions","organizations_url":"https://api.github.com/users/ubermichael/orgs","repos_url":"https://api.github.com/users/ubermichael/repos","events_url":"https://api.github.com/users/ubermichael/events{/privacy}","received_events_url":"https://api.github.com/users/ubermichael/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ubermichael/ojs","description":"Open Journal Systems","fork":true,"url":"https://api.github.com/repos/ubermichael/ojs","forks_url":"https://api.github.com/repos/ubermichael/ojs/forks","keys_url":"https://api.github.com/repos/ubermichael/ojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubermichael/ojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubermichael/ojs/teams","hooks_url":"https://api.github.com/repos/ubermichael/ojs/hooks","issue_events_url":"https://api.github.com/repos/ubermichael/ojs/issues/events{/number}","events_url":"https://api.github.com/repos/ubermichael/ojs/events","assignees_url":"https://api.github.com/repos/ubermichael/ojs/assignees{/user}","branches_url":"https://api.github.com/repos/ubermichael/ojs/branches{/branch}","tags_url":"https://api.github.com/repos/ubermichael/ojs/tags","blobs_url":"https://api.github.com/repos/ubermichael/ojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubermichael/ojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubermichael/ojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubermichael/ojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubermichael/ojs/statuses/{sha}","languages_url":"https://api.github.com/repos/ubermichael/ojs/languages","stargazers_url":"https://api.github.com/repos/ubermichael/ojs/stargazers","contributors_url":"https://api.github.com/repos/ubermichael/ojs/contributors","subscribers_url":"https://api.github.com/repos/ubermichael/ojs/subscribers","subscription_url":"https://api.github.com/repos/ubermichael/ojs/subscription","commits_url":"https://api.github.com/repos/ubermichael/ojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubermichael/ojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubermichael/ojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubermichael/ojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubermichael/ojs/contents/{+path}","compare_url":"https://api.github.com/repos/ubermichael/ojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubermichael/ojs/merges","archive_url":"https://api.github.com/repos/ubermichael/ojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubermichael/ojs/downloads","issues_url":"https://api.github.com/repos/ubermichael/ojs/issues{/number}","pulls_url":"https://api.github.com/repos/ubermichael/ojs/pulls{/number}","milestones_url":"https://api.github.com/repos/ubermichael/ojs/milestones{/number}","notifications_url":"https://api.github.com/repos/ubermichael/ojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubermichael/ojs/labels{/name}","releases_url":"https://api.github.com/repos/ubermichael/ojs/releases{/id}","deployments_url":"https://api.github.com/repos/ubermichael/ojs/deployments","created_at":"2015-07-21T21:33:47Z","updated_at":"2016-01-11T17:46:37Z","pushed_at":"2016-07-13T18:52:26Z","git_url":"git://github.com/ubermichael/ojs.git","ssh_url":"git@github.com:ubermichael/ojs.git","clone_url":"https://github.com/ubermichael/ojs.git","svn_url":"https://github.com/ubermichael/ojs","homepage":"http://pkp.sfu.ca/ojs","size":127142,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"ojs-dev-2_4"}},"base":{"label":"pkp:ojs-dev-2_4","ref":"ojs-dev-2_4","sha":"2d08ddc2a22678814c0f2c6a9bc3802b668d6247","user":{"login":"pkp","id":130896,"avatar_url":"https://avatars.githubusercontent.com/u/130896?v=3","gravatar_id":"","url":"https://api.github.com/users/pkp","html_url":"https://github.com/pkp","followers_url":"https://api.github.com/users/pkp/followers","following_url":"https://api.github.com/users/pkp/following{/other_user}","gists_url":"https://api.github.com/users/pkp/gists{/gist_id}","starred_url":"https://api.github.com/users/pkp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkp/subscriptions","organizations_url":"https://api.github.com/users/pkp/orgs","repos_url":"https://api.github.com/users/pkp/repos","events_url":"https://api.github.com/users/pkp/events{/privacy}","received_events_url":"https://api.github.com/users/pkp/received_events","type":"Organization","site_admin":false},"repo":{"id":375152,"name":"ojs","full_name":"pkp/ojs","owner":{"login":"pkp","id":130896,"avatar_url":"https://avatars.githubusercontent.com/u/130896?v=3","gravatar_id":"","url":"https://api.github.com/users/pkp","html_url":"https://github.com/pkp","followers_url":"https://api.github.com/users/pkp/followers","following_url":"https://api.github.com/users/pkp/following{/other_user}","gists_url":"https://api.github.com/users/pkp/gists{/gist_id}","starred_url":"https://api.github.com/users/pkp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkp/subscriptions","organizations_url":"https://api.github.com/users/pkp/orgs","repos_url":"https://api.github.com/users/pkp/repos","events_url":"https://api.github.com/users/pkp/events{/privacy}","received_events_url":"https://api.github.com/users/pkp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pkp/ojs","description":"Open Journal Systems","fork":false,"url":"https://api.github.com/repos/pkp/ojs","forks_url":"https://api.github.com/repos/pkp/ojs/forks","keys_url":"https://api.github.com/repos/pkp/ojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pkp/ojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pkp/ojs/teams","hooks_url":"https://api.github.com/repos/pkp/ojs/hooks","issue_events_url":"https://api.github.com/repos/pkp/ojs/issues/events{/number}","events_url":"https://api.github.com/repos/pkp/ojs/events","assignees_url":"https://api.github.com/repos/pkp/ojs/assignees{/user}","branches_url":"https://api.github.com/repos/pkp/ojs/branches{/branch}","tags_url":"https://api.github.com/repos/pkp/ojs/tags","blobs_url":"https://api.github.com/repos/pkp/ojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pkp/ojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pkp/ojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/pkp/ojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pkp/ojs/statuses/{sha}","languages_url":"https://api.github.com/repos/pkp/ojs/languages","stargazers_url":"https://api.github.com/repos/pkp/ojs/stargazers","contributors_url":"https://api.github.com/repos/pkp/ojs/contributors","subscribers_url":"https://api.github.com/repos/pkp/ojs/subscribers","subscription_url":"https://api.github.com/repos/pkp/ojs/subscription","commits_url":"https://api.github.com/repos/pkp/ojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/pkp/ojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/pkp/ojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/pkp/ojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/pkp/ojs/contents/{+path}","compare_url":"https://api.github.com/repos/pkp/ojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pkp/ojs/merges","archive_url":"https://api.github.com/repos/pkp/ojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pkp/ojs/downloads","issues_url":"https://api.github.com/repos/pkp/ojs/issues{/number}","pulls_url":"https://api.github.com/repos/pkp/ojs/pulls{/number}","milestones_url":"https://api.github.com/repos/pkp/ojs/milestones{/number}","notifications_url":"https://api.github.com/repos/pkp/ojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pkp/ojs/labels{/name}","releases_url":"https://api.github.com/repos/pkp/ojs/releases{/id}","deployments_url":"https://api.github.com/repos/pkp/ojs/deployments","created_at":"2009-11-16T21:19:14Z","updated_at":"2016-07-11T04:47:29Z","pushed_at":"2016-07-14T08:09:24Z","git_url":"git://github.com/pkp/ojs.git","ssh_url":"git@github.com:pkp/ojs.git","clone_url":"https://github.com/pkp/ojs.git","svn_url":"https://github.com/pkp/ojs","homepage":"http://pkp.sfu.ca/ojs","size":145795,"stargazers_count":265,"watchers_count":265,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":301,"mirror_url":null,"open_issues_count":34,"forks":301,"open_issues":34,"watchers":265,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pkp/ojs/pulls/924"},"html":{"href":"https://github.com/pkp/ojs/pull/924"},"issue":{"href":"https://api.github.com/repos/pkp/ojs/issues/924"},"comments":{"href":"https://api.github.com/repos/pkp/ojs/issues/924/comments"},"review_comments":{"href":"https://api.github.com/repos/pkp/ojs/pulls/924/comments"},"review_comment":{"href":"https://api.github.com/repos/pkp/ojs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pkp/ojs/pulls/924/commits"},"statuses":{"href":"https://api.github.com/repos/pkp/ojs/statuses/accff6ee5475625140b980179cda907b30c56d34"}}}}
{"actor":{"display_login":"ctgraham"}}