bluellyr Posted February 7, 2016 Share Posted February 7, 2016 Hi, I don't know if this is the right forum but, anyone knows what to do when this error happens? SyntaxError: Unexpected token < #4 http://dev.producoesindependentes.pt/beltain/beltain/page/edit/?id=1040:1:1 #3 Object.parse (native) #2 http://b.mxpnl.net/cs/dca.js?pid=39266&cid=49544_680_:3:21148 Function.na.parseJSON() #1 http://dev.producoesindependentes.pt/beltain/wire/modules/Inputfield/InputfieldFile/InputfieldFile.js?v=124-1454520337:207:23 XMLHttpRequest.() Thank you Link to comment Share on other sites More sharing options...
GuruMeditation Posted February 7, 2016 Share Posted February 7, 2016 Not sure, maybe you can post your template code? Also your admin page is showing errors. http://dev.producoesindependentes.pt/beltain/beltain/ Maybe you're trying to reference a module you have uninstalled? Link to comment Share on other sites More sharing options...
dragan Posted February 8, 2016 Share Posted February 8, 2016 Also, the frontend fails to load a JS file: https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.9.4/js/i18n/defaults-*.min.js = error 404 Link to comment Share on other sites More sharing options...
bluellyr Posted February 9, 2016 Author Share Posted February 9, 2016 Hi, I didn't manage to understand exactly what happened but a college of mine did installed some modules that were not for this PW version. This error was shown when we tried to upload an image with the image field type. This is a small site and we manage to setup all the work in a few hours. Thank you for your replies. Link to comment Share on other sites More sharing options...
justb3a Posted February 9, 2016 Share Posted February 9, 2016 I've been getting this error since yesterday, too, when trying to upload an image. I set up a fresh installation without any custom module to verify if a lately installed module causes this behaviour. But the error appears in that fresh installation as well. If I change the PHP version, the image upload works fine without any problem. Today I tried to reproduce that error on another computer - no luck, everything works as expected. Same PHP (5.6.18) and ProcessWire (2.7.3) version, both running with nginx. The new image gets uploaded, but the image doesn't appear right after the upload. I have to save the page to see the image. If I disable JavaScript I can upload an image without an error message. So in my case it's depending on the environment (and not on ProcessWire), but I haven't figured out for now what the problem/difference is. I got that error message while uploading an image already some month ago, but after some updates everything was fine again. Link to comment Share on other sites More sharing options...
BitPoet Posted February 9, 2016 Share Posted February 9, 2016 @justb3a: my personal suspect is different warning levels between the php.inis of the working and non-working system, as the error sounds like HTML injected into a JSON message. Link to comment Share on other sites More sharing options...
Wanze Posted February 9, 2016 Share Posted February 9, 2016 Check the output that is returned from the Ajax request, maybe you get a hint what's causing it server side, e.g. PHP warning or HTML message. You can do this for example in chrome with with the dev tools under "Network". Select the XHR request and choose "Response". Link to comment Share on other sites More sharing options...
justb3a Posted February 9, 2016 Share Posted February 9, 2016 .. resolved the issue in less than three minutes, yesterday I was too lazy to take a closer look (in other words: my battery was empty). Edit php.ini, to avoid this warning set 'always_populate_raw_post_data' to '-1', restart php and the message is gone ; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is ; to disable this feature and it will be removed in a future version. ; If post reading is disabled through enable_post_data_reading, ; $HTTP_RAW_POST_DATA is *NOT* populated. ; http://php.net/always-populate-raw-post-data always_populate_raw_post_data = -1 Before: <br /> <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 /> <br /> <b>Warning</b>: Cannot modify header information - headers already sent in <b>Unknown</b> on line <b>0</b><br /> [{"error":false,"message":"Added file: body.png","file":"\/site\/assets\/files\/1\/body.png","size":26952,"markup":"\n\t<li id='file_60984d6634e55217fe6424485038dd7d' class='InputfieldFileItem InputfieldImage ui-widget'>\n\t\t<p class='InputfieldFileInfo InputfieldItemHeader ui-widget ui-widget-header ui-helper-clearfix'>\n\t\t\t<span class='HideIfSingle HideIfEmpty InputfieldFileDrag'><i class='fa fa-sort'><\/i> <\/span>\n\t\t\t<i class='fa fa-caret-right InputfieldFileDrag HideIfMultiple'><\/i> \n\t\t\t<label class='InputfieldFileDelete'><input type='checkbox' name='delete_images_60984d6634e55217fe6424485038dd7d' 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\t<a class='InputfieldFileName pw-modal pw-modal-large' title='body.png: body.png (720x101)' href='\/processwire\/page\/image\/edit\/?id=1&file=1,body.png&rte=0&field=images' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'>body.png <i class='fa fa-pencil ui-priority-secondary'><\/i><\/a> \n\t\t\t<span class='InputfieldFileStats'>26 kB, 720x101 <\/span> \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\/body.png?nc=10'><img height=\"100\" src=\"\/site\/assets\/files\/1\/body.0x100.png?nc=1455052838\" alt=\"\" data-gridsize=\"100\" \/><\/a>\n\t\t\t\t<div class='InputfieldImageActions'>\n\t\t\t\t\t<a title='body.png (720x101)' href='\/processwire\/page\/image\/edit\/?id=1&file=1,body.png&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_60984d6634e55217fe6424485038dd7d' class='detail'>Description<\/label><input type='text' name='description_images_60984d6634e55217fe6424485038dd7d' id='description_images_60984d6634e55217fe6424485038dd7d' value='' \/><\/div>\n\t\t\t<input class='InputfieldFileSort' type='text' name='sort_images_60984d6634e55217fe6424485038dd7d' value='2' \/>\n\t\t<\/div>\n\t<\/li>","replace":false,"overwrite":0}] 8 Link to comment Share on other sites More sharing options...
jensweigel Posted September 22, 2017 Share Posted September 22, 2017 Got this problem now overnight. PHP Version is 7.1 so "always_populate_raw_post_data" is deprecated. Strange is I can upload only some images. Also files aren't a problem. In some case I get the SyntaxError: Unexpected token < Any ideas? Link to comment Share on other sites More sharing options...
jensweigel Posted September 22, 2017 Share Posted September 22, 2017 A follow to my previous post: I think this a weird problem. I tried it with some images and it turns out that only images form Adobe Stock have this problem also Fotolia (wich are the same but different payment options) Shutterstock is no problem. Even if I resize/crop the Adobe Images the problem remains … So I think I just don't use Adobe Stock… Link to comment Share on other sites More sharing options...
fbg13 Posted September 22, 2017 Share Posted September 22, 2017 Share one photo that doesn't work, if you can, so that others can check. Also if you tested it with a clean install you should open an issue on github. Link to comment Share on other sites More sharing options...
jensweigel Posted September 22, 2017 Share Posted September 22, 2017 I have tried it with another PW installation but it works. Can't share is because of the license. But I get it with every Preview image form stock.adobe.com Link to comment Share on other sites More sharing options...
fbg13 Posted September 22, 2017 Share Posted September 22, 2017 Do you have any images related modules or custom code? What PW version are you on? 1 Link to comment Share on other sites More sharing options...
jensweigel Posted September 22, 2017 Share Posted September 22, 2017 (edited) Edited: just rechecked everythink – now it works. Thats weird. Edited September 22, 2017 by jensweigel Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now