{"action":"created","issue":{"url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1174","labels_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1174/labels{/name}","comments_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1174/comments","events_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1174/events","html_url":"https://github.com/ryancramerdesign/ProcessWire/issues/1174","id":77307654,"number":1174,"title":"Issue with AJAX File Uploads in 2.6.0.","user":{"login":"PaulAik","id":99102,"avatar_url":"https://avatars.githubusercontent.com/u/99102?v=3","gravatar_id":"","url":"https://api.github.com/users/PaulAik","html_url":"https://github.com/PaulAik","followers_url":"https://api.github.com/users/PaulAik/followers","following_url":"https://api.github.com/users/PaulAik/following{/other_user}","gists_url":"https://api.github.com/users/PaulAik/gists{/gist_id}","starred_url":"https://api.github.com/users/PaulAik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PaulAik/subscriptions","organizations_url":"https://api.github.com/users/PaulAik/orgs","repos_url":"https://api.github.com/users/PaulAik/repos","events_url":"https://api.github.com/users/PaulAik/events{/privacy}","received_events_url":"https://api.github.com/users/PaulAik/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/labels/Need%20More%20Information","name":"Need More Information","color":"fef2c0"},{"url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/labels/Needs%20Confirmation","name":"Needs Confirmation","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-05-17T13:11:32Z","updated_at":"2015-07-22T11:37:10Z","closed_at":null,"body":"Hi,\r\n\r\nI'm getting the following issue reported back to the browser console when trying to upload images via the default file uploader in the admin section:\r\n\r\n```\r\nUncaught SyntaxError: Unexpected token <\r\n```\r\n\r\nDigging further, I think it's because PHP is actually generating this in the response back to the browser after a successful image upload:\r\n```\r\n<br />\r\n<b>Deprecated</b>:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in <b>Unknown</b> on line <b>0</b><br />\r\n<br />\r\n<b>Warning</b>:  Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br />\r\n[{\"error\":false,\"message\":\"Added file: slide1.jpg\",\"file\":\"\\/site\\/assets\\/files\\/1\\/slide1.jpg\",\"size\":32505,\"markup\":\"\\n\\t<li id='file_e08fe7a0e9958acf28b5b684e0e2983a' class='InputfieldFileItem InputfieldImage ui-widget'>\\n\\t\\t<p class='InputfieldFileInfo InputfieldItemHeader ui-widget ui-widget-header'>\\n\\t\\t\\t<i class='fa fa-fw fa-sort HideIfSingle'><\\/i>\\n\\t\\t\\t<i class='fa fa-fw fa-caret-right HideIfMultiple'><\\/i> \\n\\t\\t\\t<a class='InputfieldFileName pw-modal pw-modal-large' title='slide1.jpg (1100x440)' href='\\/processwire\\/page\\/image\\/edit\\/?id=1&file=1,slide1.jpg&rte=0&field=images' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'>slide1.jpg <i class='fa fa-pencil ui-priority-secondary'><\\/i><\\/a> \\n\\t\\t\\t<span class='InputfieldFileStats'>32&nbsp;kB, 1100x440  <\\/span> \\n\\t\\t\\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_images_e08fe7a0e9958acf28b5b684e0e2983a' value='1' title='Delete' \\/><i class='fa fa-fw fa-trash'><\\/i><\\/label>\\n\\t\\t\\t<a class='InputfieldFileMove InputfieldFileMoveBottom' href='#' title='Move to bottom'><i class='fa fa-fw fa-angle-double-down'><\\/i><\\/a> \\n\\t\\t\\t<a class='InputfieldFileMove InputfieldFileMoveTop' href='#' title='Move to top'><i class='fa fa-fw fa-angle-double-up'><\\/i><\\/a> \\n\\t\\t<\\/p>\\n\\t\\t<div class='InputfieldFileData ui-widget ui-widget-content'>\\n\\t\\t\\t<div class='InputfieldImagePreview'>\\n\\t\\t\\t\\t<a class='InputfieldFileLink' target='_blank' href='\\/site\\/assets\\/files\\/1\\/slide1.jpg?nc=10'><img height=\\\"100\\\" src=\\\"\\/site\\/assets\\/files\\/1\\/slide1.0x100.jpg?nc=1431867408\\\" alt=\\\"\\\" data-gridsize=\\\"100\\\"  \\/><\\/a>\\n\\t\\t\\t\\t<div class='InputfieldImageActions'>\\n\\t\\t\\t\\t\\t<a title='slide1.jpg (1100x440)' href='\\/processwire\\/page\\/image\\/edit\\/?id=1&file=1,slide1.jpg&rte=0&field=images' class='pw-modal pw-modal-large' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><i class='fa fa-fw fa-crop'><\\/i><\\/a>\\n\\t\\t\\t\\t<\\/div>\\n\\t\\t\\t<\\/div>\\n\\t\\t\\t<div class='InputfieldFileDescription'><label for='description_images_e08fe7a0e9958acf28b5b684e0e2983a' class='detail'>Description<\\/label><input type='text' name='description_images_e08fe7a0e9958acf28b5b684e0e2983a' id='description_images_e08fe7a0e9958acf28b5b684e0e2983a' value='' \\/><\\/div>\\n\\t\\t\\t<input class='InputfieldFileSort' type='text' name='sort_images_e08fe7a0e9958acf28b5b684e0e2983a' value='0' \\/>\\n\\t\\t<\\/div>\\n\\t<\\/li>\",\"replace\":false,\"overwrite\":0}]\r\n```\r\n\r\nLooks like the second part in the response (the bit that's actually a JSON response) is what the script is expecting to see, but instead it's trying to parse the warning message back from PHP (I'm running PHP 5.6.3 on my Mac if that helps).\r\n\r\nI reckon I can turn this warning off to fix the issue, but I've seen this reported a few times in the forums so it might be worth putting a fix in place for if possible. Unfortunately I'm not sure $HTTP_RAW_POST_DATA is populated, so I can't fix myself right now!"},"comment":{"url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/comments/123683132","html_url":"https://github.com/ryancramerdesign/ProcessWire/issues/1174#issuecomment-123683132","issue_url":"https://api.github.com/repos/ryancramerdesign/ProcessWire/issues/1174","id":123683132,"user":{"login":"ryancramerdesign","id":328272,"avatar_url":"https://avatars.githubusercontent.com/u/328272?v=3","gravatar_id":"","url":"https://api.github.com/users/ryancramerdesign","html_url":"https://github.com/ryancramerdesign","followers_url":"https://api.github.com/users/ryancramerdesign/followers","following_url":"https://api.github.com/users/ryancramerdesign/following{/other_user}","gists_url":"https://api.github.com/users/ryancramerdesign/gists{/gist_id}","starred_url":"https://api.github.com/users/ryancramerdesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryancramerdesign/subscriptions","organizations_url":"https://api.github.com/users/ryancramerdesign/orgs","repos_url":"https://api.github.com/users/ryancramerdesign/repos","events_url":"https://api.github.com/users/ryancramerdesign/events{/privacy}","received_events_url":"https://api.github.com/users/ryancramerdesign/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T11:37:10Z","updated_at":"2015-07-22T11:37:10Z","body":"Looks like you've got something injecting JavaScript into your requests\n(hacked?). Start by checking your index.php and .htaccess files.\nOn Jul 22, 2015 6:15 AM, \"qqnamunew\" <notifications@github.com> wrote:\n\n> @teppokoivula <https://github.com/teppokoivula> You are right. I get this\n> in response:\n>\n> [{\"error\":false,\"message\":\"Dodane pliki: hk.jpg\",\"file\":\"\\/site\\/assets\\/files\\/1091\\/hk.jpg\",\"size\":187786,\"markup\":\"\\n\\t<li id='file_0b64f721506a83159fd9c6d64617a379' class='InputfieldFileItem InputfieldImage ui-widget'>\\n\\t\\t<p class='InputfieldFileInfo InputfieldItemHeader ui-widget ui-widget-header'>\\n\\t\\t\\t<i class='fa fa-fw fa-sort HideIfSingle'><\\/i>\\n\\t\\t\\t<i class='fa fa-fw fa-caret-right HideIfMultiple'><\\/i> \\n\\t\\t\\t<a class='InputfieldFileName pw-modal pw-modal-large' title='hk.jpg (1177x577)' href='\\/panel\\/page\\/image\\/edit\\/?id=1091&file=1091,hk.jpg&rte=0&field=images' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'>hk.jpg <i class='fa fa-pencil ui-priority-secondary'><\\/i><\\/a> \\n\\t\\t\\t<span class='InputfieldFileStats'>183&nbsp;kB, 1177x577  <\\/span> \\n\\t\\t\\t<label class='InputfieldFileDelete'><input type='checkbox'\n>   name='delete_images_0b64f721506a83159fd9c6d64617a379' value='1' title='Delete' \\/><i class='fa fa-fw fa-trash'><\\/i><\\/label>\\n\\t\\t\\t<a class='InputfieldFileMove InputfieldFileMoveBottom' href='#' title='Move to bottom'><i class='fa fa-fw fa-angle-double-down'><\\/i><\\/a> \\n\\t\\t\\t<a class='InputfieldFileMove InputfieldFileMoveTop' href='#' title='Move to top'><i class='fa fa-fw fa-angle-double-up'><\\/i><\\/a> \\n\\t\\t<\\/p>\\n\\t\\t<div class='InputfieldFileData ui-widget ui-widget-content'>\\n\\t\\t\\t<div class='InputfieldImagePreview'>\\n\\t\\t\\t\\t<a class='InputfieldFileLink' target='_blank' href='\\/site\\/assets\\/files\\/1091\\/hk.jpg?nc=1437559944'><img src=\\\"\\/site\\/assets\\/files\\/1091\\/hk.jpg?nc=1437559944\\\" alt=\\\"\\\" data-gridsize=\\\"100\\\"  \\/><\\/a>\\n\\t\\t\\t\\t<div class='InputfieldImageActions'>\\n\\t\\t\\t\\t\\t<a title='hk.jpg (1177x577)' href='\\/panel\\/page\\/image\\/edit\\/?id=1091&\n>  file=1091,hk.jpg&rte=0&field=images' class='pw-modal pw-modal-large' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><i class='fa fa-fw fa-crop'><\\/i><\\/a>\\n\\t\\t\\t\\t<\\/div>\\n\\t\\t\\t<\\/div>\\n\\t\\t\\t<div class='InputfieldFileDescription'><label for='description_images_0b64f721506a83159fd9c6d64617a379' class='detail'>Opis<\\/label><input type='text' name='description_images_0b64f721506a83159fd9c6d64617a379' id='description_images_0b64f721506a83159fd9c6d64617a379' value='' \\/><\\/div>\\n\\t\\t\\t<input class='InputfieldFileSort' type='text' name='sort_images_0b64f721506a83159fd9c6d64617a379' value='2' \\/>\\n\\t\\t<\\/div>\\n\\t<\\/li>\",\"replace\":false,\"overwrite\":0}]<script type=\"text/javascript\"><!--\n> document.writeln('<'+'scr'+'ipt type=\"text/javascript\" src=\"http://home.hit.stat24.com/_'+(new Date()).getTime()+'/script.js?id=.cdLcC7CWNVDzoqip9uEy5YlfQrFHAezVjtqY47rWTf.k7\"></'+'scr'+'ipt>');\n> //--></script>\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/ryancramerdesign/ProcessWire/issues/1174#issuecomment-123651886>\n> .\n>\n"}}