I'm getting the following errors when previewing a node:
* warning: Invalid argument supplied for foreach() in /home/mysite/public_html/dev/sites/all/modules/cck/content.module on line 1113.
* warning: Invalid argument supplied for foreach() in /home/mysite/public_html/dev/sites/all/modules/cck/content.module on line 1153.
* warning: Invalid argument supplied for foreach() in /home/mysite/public_html/dev/sites/all/modules/cck/content.module on line 1153.
* warning: Invalid argument supplied for foreach() in /home/mysite/public_html/dev/sites/all/modules/cck/includes/content.token.inc on line 18.
This is happening with my current site running D6.3, tried it with CCK 6.x-2.0-beta, 6.x-2.0-rc4 and 6.x-2.x-dev but its still returning those errors. I tried doing a fresh install of CCK and re-recreated my fields thinking that this might go away. I also installed two new D6.3 sites with same modules as the current (different database) but the ERRORS STILL PERSIST.
Errors persist on any node type with a link field (versions 6.x-2.2, 6.x-2.3 and 6.x-2.3.1). If I leave the link field blank or disable it the preview problem seems to go away.
If you want to take an actual look to whats happening on my site please go to login as testuser and 123456 as the pw. Create a 'Test Content with Link' then preview that so you can see the error and check whats going on.
Please look into this. Thanks.
P.S to mods: This is not a duplicate post. I have closed the other one for a more clean and concise explanation here.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | link_preview_warning-285293-22.patch | 1.07 KB | mrtoner |
| #11 | link_preview_warning.patch | 1.2 KB | quicksketch |
| #4 | link_preview_warning.patch | 701 bytes | quicksketch |
Comments
Comment #1
pathogen commentedi was able to reproduce your error on your site.. I noticed that if you create the post without previewing there are no issues.
I couldn't reproduce these errors on my 6.2 site with a cck link field, when I update I'll see what happens and post back here.
Comment #2
quicksketchThanks pathogen. Being able to reproduce will be key to fixing the problem. I've never seen this problem before either, but I think a few others have reported it also.
Comment #3
halloffame commentedThanks pathogen let us know immediately. Drupal 6.2 is also doing fine for me. It started when I upgraded to 6.3. 3 of my sites running D6.3 were able to reproduce these erorrs.
Comment #4
quicksketchIt'd help if I really read the issue. I wasn't trying Preview, I was just submitting. I reproduced it right away after looking for the right thing.
The trouble is token module building the node while there is no $nid available. The result is an empty node that when CCK tries to get a list of fields, it only gets a boolean FALSE. Please try out this patch and let me know if it solves the problem for you.
Comment #5
halloffame commentedAm getting this
1 out of 1 hunk FAILED -- saving rejects to file link.module.rejComment #6
halloffame commentedI have applied the patch manually (total newbie here so its best if you could rewrite the patch) but the warning/error still persist when previewing the node.
Comment #7
Matthew OMalley commentedI see this issue in the 5.x-2.3.1 version as well. Issue only exists on Preview, and only before the node has been submitted - after submitting the node, preview works fine.
I have tried turning off "Allow user-entered tokens" on the field edit admin page, which removes some of the errors, but there are still some errors displaying.
Comment #8
Matthew OMalley commentedI will keep posting here, rather than creating another issue for the 5.x version, since it looks like it's the same issue for both. Let me know if you'd like me to create a new issue.
The errors that are displaying in 5.x are:
Site is running Drupal 5.7, CCK 5.x-1.7
Comment #9
Matthew OMalley commentedWhen I check "Allow user-entered tokens" when editing the field in the content type, then I just get the exact same error as above, but twice.
Comment #10
Matthew OMalley commentedI think you have the solution in the patch, it just needs to go into two places.
For 5.x-2.3.1, use this line:
in the place of this line:
At lines 590 and 697.
Comment #11
quicksketchHere's a patch that applies in both places where tokens are replaced.
Comment #12
halloffame commentedI'm getting
Nonetheless, I have applied the patch manually and IT WORKED like a charm!
Thank you very much!
Comment #13
quicksketchGreat, I've committed to both the Drupal 5 and 6 versions.
Comment #14
drew reece commentedI'm hunting around for a fix to a problem that seems to be similar.
I'm using Drupal 5.9 with cck, link, token and auto_nodetitle. I get
Invalid argument supplied for foreach() in /xxx/modules/node/node.module on line 561.followed by mysql errors when I submit a cck type with a link field. The error ceases when I turn off the option to allow the usage of tokens in the link field.Using auto node_title to create the title automatically from tokens doesn't cause the error, making me think the issue is with link module not token module?
I'm trying the patch in #11, replacing lines 590 & 696 since the patch doesn't translate for the 5.x version. Also in the 5.x version the variable is called
$nodenot$token_nodeas in the 6.x patch, so I changed this and it seems to work.It looks like there are other posts with this same issue, it's kinda hard to keep track :)
http://drupal.org/node/142286
http://drupal.org/node/283805
http://drupal.org/node/285293
http://drupal.org/node/282305
Hopefully the issue is with link and not token.
Drew
Comment #15
keathmilligan commentedI have the problem evilgenius originally posted:
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/cck/content.module on line 1112.
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/cck/content.module on line 1152.
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/cck/content.module on line 1152.
warning: Invalid argument supplied for foreach() in /home/mysite/public_html/sites/all/modules/cck/includes/content.token.inc on line 18.
It goes away if I disable the token module.
Comment #16
drew reece commented@ keathmilligan,
My understanding is that the issue IS with the link module, but it is within a block of code that tests the token module is active. So disabling token module will appear to fix it, but actually you are simple avoiding using the problematic code, and losing all the great features of token.
Try adding the patch in post 11 to link module, evil genius suggests doing so manually (#12). Here is info on patching http://drupal.org/node/60108.
If it fails to patch just open the .patch file in a text editor and remove lines starting with '-' from the link.module and add lines starting with a '+' to the link.module file. Don't add the actual '+'s
There are line numbers listed within the .patch to help you find where the changes are, and there are also lines that have no '+' or '-' that stay the same, but help you find the location of the change.
HTH
Comment #17
momper commentedfeedback: patch seems to work ...
thanks a lot
momper
Comment #18
keathmilligan commentedI'm still getting the error shown in #15. Something is still broken here.
Edit: I found what was going on. Conflict with another module...
Comment #19
drew reece commented@keathmilligan.
I realize your error is not related to the original thread, but if you fixed it please post how. If it's possible someone else can make the same error appear, do a search for the error message and get to this thread. It is useful to see what helped fix it for you.
Also if there are conflicts it may be worth posting to the relevant module issue queues so the maintainers get a chance to look into it.
Comment #20
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #21
nirvanajyothi commentedthe patch worked for me.Did it using cygwin.Thank you.
Comment #22
mrtoner commentedConfirmed. Patch in #11, manually applied, fixes the problem. Re-rolling patch, may help those for whom #11 didn't apply. Updating (downdating ?) issue to RTBC, since quicksketch still hasn't committed to a release version and this issue needs to be on his radar. :-) Also makes it easier to find for those with the problem.
Comment #23
quicksketchThanks mrtoner.
I'm releasing a new version tonight. :)
Comment #24
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #25
el_reverend commentedHi all,
I just had the same problem with the Event and Link module. I followed two tips given here. One was to edit my content type fields (manage field) and disabled all fields that use token replacement (click configure in each field). My culprit was the link CCK type.
While that solved some of my issue it did not solve all problems. I edited the link.module (line 697) from this:
to this:
I got the idea from here: http://drupal.org/node/142286 and take a look at comment number 8.
I am now trouble free from the preview bug. I hope this helps you as well. If someone would like to create a patch for these modules that would be greatly appreciated. How about fixing this issue even in the older 5.x versions?
Comment #25.0
halloffame commentedRemove ref to the site..