-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when add/update post - Invalid argument supplied for foreach() - qtx_admin.php on line 14 #392
Comments
Comment by johnclause I still have no idea how that happens ... Probably older version of PHP is at fault, but what exactly is happening? Nobody troubleshooted it to the answer. We could never reproduce it and we have never gained an admin access to troubleshoot it. Would you have enough PHP skills to figure out what is going on? |
Comment by nunospot I'm developing on my localhost, I didn't test it online yet, but I will give it a try. Anyway my php version is 4.6.1, so I don't think it's a php problem. I'm using the qtranslate-x with the ACF to translate a several fields. I think the problem is when this fields are not filled so the $content on the foreach is NULL, in others words, the argument is invalid. And no, i'm not that good in PHP :\ |
Comment by johnclause 4.6.1 is pretty low by now. NULL is what I do not understand, $content comes from $_POST, which should never have any nulls. Where this NULL come from? Sounds like an imperfection in ACF, which is not important anywhere else, but just causes this message. Could you try to figure out a simple reproducible case? |
Comment by nunospot Yeah sorry, I was telling the phpMyAdmin version. The php is 5.5.19. NULL I think comes from the fields that have not been filled. |
Comment by johnclause Yes, they apparently come from that, but it should not be a case. Empty fields come as empty strings, not NULL, in normal case. We can put "if(is_null(...)) ...", but it is strange to run an extra code just to offset either older PHP or imperfections in other plugin development? I would like to find out the true cause of this first. And for that I need a way to reproduce it. |
Comment by nunospot I have the ACF pro version. I can give you access to the development in if you want. |
Comment by johnclause Access to localhost? I would think ACF Pro and regular would behave the same, as it seems basic. Could you describe the minimum steps to reproduce first? What kind of field one need to create and not to fill and where in order to see this message? Please, assume no knowledge of ACF for a reader. Maybe I will eventually able to reproduce on my localhost. |
Comment by nunospot I have a dev environment on a server. What do you need specifically? I have several fields to fill (for example: text fields, wysiwyg editors, repeaters, images e etc) for this post and those fields, except the images, can be translated by the q-translate. |
Comment by johnclause I've never done anything with ACF and I would not like to spend time to learn. It would be great, if you could give me set of instructions what to do to see the error message you are seeing. |
Comment by johnclause I tried a few fields, and I cannot hit this problem, never was able to to. If you wish to help, give us precise instructions what to do to reproduce, or admin access to a site with explanation what page to go and wht to do to observe the problem. |
Comment by nunospot Hi John, yeah ofc. I can't give you the access right because I don't have the access here you my personal computer, but monday on the work I can give it to you or reproduce another environment where you can see what going on. |
Comment by nunospot Hi john. Give me your email so I can send you the access. |
Comment by johnclause The contact information is in the link I sent you: https://qtranslatexteam.wordpress.com/contact-us/ |
Comment by johnclause Thank you very much, @NC0STA, for setting up a test server for us.We would never be able to reproduce it on our servers, because it happens when a page has a hidden, unused translatable field and when user has the first language chosen when "Update" is pressed 👍 It happens with ACF mostly, but potentially can happen in other plugins too. The fix is here: qTranslate-Team/qtranslate-x@7586ff0 |
Comment by riverofjanuary FWIW I just installed the very latest version from the git repo (3.4.8) and had this exact error (on ACF site with fields moved around). I had to manually apply the "isset" fix (that @johnclause links to immediately above) to the |
Comment by pwolfert I had the same problem as @riverofjanuary and saw that the fix is in the |
Comment by dxit-gg Hi there,
Regards |
Comment by fabianhijlkema Had the same issue, @dxit-gg answer fixed it for me too. Also using ACF pro. |
Comment by janeschindler I had two conflicts with ACF-qtranslate (the ACF integration plugin). 1) I got this error on line 14. Thank you for the fix (I haven't confirmed that it's working because I don't understand what you mean by 'first language' in this comment: qTranslate-Team/qtranslate-x#392 (comment). I have the issue but haven't been able to reproduce reliably. Would be great if you could clarify). 2) When I edited and saved group ACF fields, the fields I had put inside groups were all replicated outside the groups but without field names (funkjedi/acf-qtranslate#111). After a quick test this also seems to have been fixed. Is that possible? I really hope it doesn't happen any more. |
Comment by janeschindler I am using the stable branch now with the fix and just had this error again (invalid argument on line 14). My site deletes the entirety of the post in the language that's being edited (but not the other languages). I've upped the max_input_vars for php and hope that might help. Very glad if anyone has other ideas. |
Hey everyone! I'm still experiencing the issue as the fix by @dixit-gg did not work for me. It simply bypasses the error while avoiding to save any fields or rows beyond the "affected" one which returns empty brackets. I'm running the following: q-Translate-X Version 3.4.6.8 Am I missing something aside from applying the provided code in the qt-admin.pp ? |
Update: As I seem to have used quite a lot of fields, and this occurred on out-of-the-box local web server it never occurred to me that the limits might be too narrow. After upping the memory limits of php/wp the issue did not reappear (no other changes were made). |
Issue by nunospot
Wednesday Jun 08, 2016 at 14:07 GMT
Originally opened as qTranslate-Team/qtranslate-x#392
I get a error when I try to add or update a post:
I saw a thread on wordpress support page with the same error - https://wordpress.org/support/topic/warning-shown-on-page-update-qtranslate-xadminqtx_adminphp-on-line-14?replies=8
I'm using the workaround set by david.sota.ads, but like John Clause said this will only solve the error messages not the actual problem.
The text was updated successfully, but these errors were encountered: