payload: {"action":"created","issue":{"url":"https://api.github.com/repos/z-song/laravel-admin/issues/2278","repository_url":"https://api.github.com/repos/z-song/laravel-admin","labels_url":"https://api.github.com/repos/z-song/laravel-admin/issues/2278/labels{/name}","comments_url":"https://api.github.com/repos/z-song/laravel-admin/issues/2278/comments","events_url":"https://api.github.com/repos/z-song/laravel-admin/issues/2278/events","html_url":"https://github.com/z-song/laravel-admin/issues/2278","id":347734839,"node_id":"MDU6SXNzdWUzNDc3MzQ4Mzk=","number":2278,"title":"Pjax middleware 过滤的时候 script 标签问题","user":{"login":"Quekie","id":13919102,"node_id":"MDQ6VXNlcjEzOTE5MTAy","avatar_url":"https://avatars0.githubusercontent.com/u/13919102?v=4","gravatar_id":"","url":"https://api.github.com/users/Quekie","html_url":"https://github.com/Quekie","followers_url":"https://api.github.com/users/Quekie/followers","following_url":"https://api.github.com/users/Quekie/following{/other_user}","gists_url":"https://api.github.com/users/Quekie/gists{/gist_id}","starred_url":"https://api.github.com/users/Quekie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Quekie/subscriptions","organizations_url":"https://api.github.com/users/Quekie/orgs","repos_url":"https://api.github.com/users/Quekie/repos","events_url":"https://api.github.com/users/Quekie/events{/privacy}","received_events_url":"https://api.github.com/users/Quekie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-08-05T22:01:40Z","updated_at":"2019-04-19T18:00:36Z","closed_at":null,"author_association":"NONE","body":"- Laravel Version: 5.5\r\n- PHP Version: 7.1\r\n- Laravel-admin:  1.5.9\r\n\r\n### Description:\r\n当\\Encore\\Admin\\Middleware\\Pjax 尝试过滤的时候,用了 DOMDocument的 loadHTML 方法, 然而 loadHtml 会自动 把Script 标签内的第一个  '</' 当做结束符,导致返回错误的结果.\r\n \\Encore\\Admin\\Middleware\\Pjax  try to filter response with DOMDocument->loadHTML(), how ever ,\r\nloadHtml HTML parser is required to take the first \"</\" as marking the end of the script element.\r\n\r\n\r\n相关问题 :  \r\n[stackoverflow](https://stackoverflow.com/questions/24575136/domdocument-removes-html-tags-in-javascript-string)\r\n[stackoverflow](https://stackoverflow.com/questions/15925961/domdocument-remove-script-tags-from-html-source)\r\n\r\n我的临时解决方法 (str_get_html 是simple html dom 的一个方法):\r\nMy temporary solution (str_get_html is from simple_html_dom): \r\n\r\n    protected function filterResponse(Response $response, $container)\r\n    {\r\n        $html = $response->getContent();\r\n        $dom = str_get_html($html, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT);\r\n        $tittle = $dom->find('title')[0];\r\n        $content = $dom->find($container)[0];\r\n        $response->setContent( $tittle.$content );\r\n        return $this;\r\n    }\r\n\r\n希望对大家有帮助.\r\nI hope it's helpful"},"comment":{"url":"https://api.github.com/repos/z-song/laravel-admin/issues/comments/484972333","html_url":"https://github.com/z-song/laravel-admin/issues/2278#issuecomment-484972333","issue_url":"https://api.github.com/repos/z-song/laravel-admin/issues/2278","id":484972333,"node_id":"MDEyOklzc3VlQ29tbWVudDQ4NDk3MjMzMw==","user":{"login":"cyclegtx","id":5106099,"node_id":"MDQ6VXNlcjUxMDYwOTk=","avatar_url":"https://avatars1.githubusercontent.com/u/5106099?v=4","gravatar_id":"","url":"https://api.github.com/users/cyclegtx","html_url":"https://github.com/cyclegtx","followers_url":"https://api.github.com/users/cyclegtx/followers","following_url":"https://api.github.com/users/cyclegtx/following{/other_user}","gists_url":"https://api.github.com/users/cyclegtx/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclegtx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclegtx/subscriptions","organizations_url":"https://api.github.com/users/cyclegtx/orgs","repos_url":"https://api.github.com/users/cyclegtx/repos","events_url":"https://api.github.com/users/cyclegtx/events{/privacy}","received_events_url":"https://api.github.com/users/cyclegtx/received_events","type":"User","site_admin":false},"created_at":"2019-04-19T18:00:36Z","updated_at":"2019-04-19T18:00:36Z","author_association":"NONE","body":"建议将 js中的html代码用php escape 加密，在js里用的时候再unescape，这样可以绕过Pjax middleware对\"</\"的过滤"}}
other: {"actor":{"display_login":"cyclegtx"}}