Closed (outdated)
Project:
AJAX Comments
Version:
6.x-1.8
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
24 Mar 2009 at 17:22 UTC
Updated:
8 Jun 2020 at 18:32 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
drupalina commentedsorry, that error message didn't post correctly. I forgot the < code > tags.
It should read
Plus: it also happens with the latest .dev version and also 1.6
Comment #2
neochief commentedYes, I found this bug yesterday too. I'm working on resolving this issue. Thanks for your report.
Comment #3
munikho commentedNoticed it as well, only since the latest dev. It's somewhere in the latest js file.
Comment #4
OneTwoTait commentedThis happens for me as well but seems to only be happening on the translated version of the page. Posting on the original English version of the node worked.
Comment #5
nirad commentedsubscribing
Comment #6
virtualdrupal commentedSubscribing.. Was working fine yesterday, not today
Comment #7
virtualdrupal commentedNot sure if something changed but this article was just recently updated... http://drupal.org/node/331941
Comment #8
sashken2 commentedПериодически выскакивают ошибки.
Такая:
И такая:
Comment #9
evilworm commentedThis bug happens after I try to post two comments in a row... the first comment gets posted, the second outputs this error
using latest development version
Comment #10
damienmckennaUpdating the title to be more clear where the error is.
Comment #11
a.mohax commentedЕсли при добавлении нажимать "Предпросмотр" ошибка такая
warning: Invalid argument supplied for foreach() in Z:\home\about\www\sites\all\modules\cck\content.module on line 1278.У меня из кода темы верезан участок, который выводит заголовок комента. В настройках темы заголовок отключен.
Может в этом проблема?!
зы: модули стоят такие: ajax_comments, auto_nodetitle, bookmarks, bueditor, cck, dhtml_menu, filefield, imageapi, imagecache, imagefield, pathauto, privatemsg, token, user_karma, views, vote_up_down, votingapi.
(самые последние версии;)
ззы: надеюсь помог, а не рассмешил
Comment #12
damienmckennaa.mohax: English, please.
Comment #13
nirad commentedTranslation using Google:
If you are adding to click "Preview" error, such
warning: Invalid argument supplied for foreach() in Z:\home\about\www\sites\all\modules\cck\content.module on line 1278.
I have a poster of the code verezan plot, which displays the title комента. In the settings of the topic title is off.
Can this problem?
threat: modules are as follows: ajax_comments, auto_nodetitle, bookmarks, bueditor, cck, dhtml_menu, filefield, imageapi, imagecache, imagefield, pathauto, privatemsg, token, user_karma, views, vote_up_down, votingapi.
(latest version;)
zzy: hope to help and not laugh
Comment #14
dicreat commentedsubscribing
When I try to post a comment, I see this error:
warning: array_shift() [function.array-shift]: The argument should be an array in /www/sites/all/modules/ajax_comments/ajax_comments.module on line 118.When I try to make a preview of a comment, I see this error:
Any suggestion?
Comment #15
Flying Drupalist commentedI'm also getting the same thing as the op. However it doesn't look like all the posts in this issue are about the same issue?
Comment #16
Flying Drupalist commentedComment #17
damienmckenna@Flying: I think there are multiple issues that boil down to a simple fact that ajax_comments needs to be updated to work cleanly with the proper APIs, and that should take care of most of these issues, and from there we could see what was left.
Comment #18
Flying Drupalist commentedThanks, well explained.
Comment #19
bacchus101 commentedSame issue.
Subscribing.
Comment #20
alanmparry commentedI have the same issue also, with both the 1.7 and dev release
subscribing
Comment #21
neochief commentedSorry, guys, I was too far from my work place this month to fix this stuff. Anyway, I finally did it. You may find a fix in dev. version (for 21-Apr). I'll fix some other issues in the queue and than make a release. Please, test dev and tell me your results.
Thank you very much for pattience and sorry for inconvenience.
Comment #22
OneTwoTait commentedOnly the dev version from Mar 25 is on http://drupal.org/project/ajax_comments right now.
Comment #23
Flying Drupalist commentedYou need to wait for the package to be built in a few hours, or you can grab it from cvs.
Thanks neochief!
Comment #24
daniel wentsch commentedI just had the same problem, updated to today's dev version and now works like a charm. Thanks a lot, that's really a useful module, especially for the use inside forums :)
Comment #26
Sownn commentedsame issues.
first time preview -> OK
second time preview -> array_shift error
Comment #27
neochief commentedWhat version do you use?
Comment #28
Sownn commentedthanks your reply.
re-test it, it cause by called drupal_rebuild_theme_registry(). i del it and works.
but another bug found.
it not work with comments_form_alter()
for example,
$form['preview'] = array('#type' => 'button', '#value' => t('GO'), '#weight' => 20);
if I change the #value, it will be error
maybe cause by ajax_comments.module
if ($form_state['values']['op'] == t('Preview')) {
(not the Ajax comments issue)
Comment #29
nirad commentedstill getting this error with dev version from 2009-Apr-22
Comment #30
Babalu commentedsubscribing
Comment #31
scoorch commentedalso having this error with dev version from 2009-Apr-22. First comment works fine then I get
Comment #32
Gyt commentedsubscribing
Comment #33
jrpowell01 commentedim uninstalling this til a solution is made. No one can comment on my forums.
Comment #34
andypostSuppose problem caused by caching...
This patch solves this problem.
Comment #35
andypostchanging status
Comment #36
dicreat commentedPatch don't work for me.
Comment #37
nirad commentedpatch didn't work. and this was on a test site that has no caching enabled.
Comment #38
andypostpatch made against -dev version
and it does not depends on site caching at all - form should be cached to use ahah
For example http://api.drupal.org/api/function/poll_form/6
Comment #39
simplyManu commentedI installed the patch from #34 over the dev version from May-21 (newest) and getting the same error, now on line 119 (because of the line added by the path).
Thank you andypost for your work. Great module.
Comment #40
Kostyan_Vinnikov commentedЭта проблема была решена?
This problem has been solved?
Comment #41
jeno-1 commentedI am having this issue after upgrading to Drupal 6.13
Comment #42
taran2li get the same error with 1.7 version
Comment #43
neochief commentedHey guys, I came to fix this finally. If you want this problem to be resolved, please provide me with the installation (files + database dump) on which it can be reproduced, as it can't be reproduced on vanilla installation. You can send me download links via my contact form.
PS. Of course, I respect your privacy.
Comment #44
neochief commentedComment #45
zarudnyi commentedInstalling a dev version completely solved the problem.
Thanks for a nice module a lot.
Comment #46
dicreat commentedI see this error when module memcache enabled. If I turn off memcache module, error gone away.
Comment #47
Craftsman commentedhave the same issue
subscribe
Comment #48
nikemen commentedUsing last dev version still doesn't work if Authcache is enabled.
Comment #49
Flying Drupalist commentedI think Authcache has a list of what should not be cached. You should try to get it added there.
Comment #50
ltwinner commentedI get this warning when I try to reply to a comment:
warning: array_shift() [function.array-shift]: The argument should be an array in /var/www/drupal/sites/all/modules/ajax_comments/ajax_comments.module on line 109.When I am just replying to the node itself ajax_comments works fine.
Comment #51
hmquien commentedIf I show comments like this:
print $content;
Ajax comments works perfect. But if I show them this way:
print $node->body;
if(arg(0) == 'node' && is_numeric(arg(1))&& !arg(2)) {
$t_node = node_load(arg(1));
if (function_exists('comment_render') && $t_node->comment) {
print comment_render($t_node);
}
}
Then I get this awful error:
warning: array_shift() [function.array-shift]: The argument should be an array in C:\xampp\htdocs\intereconomia\sites\default\modules\ajax_comments\ajax_comments.module on line 120
This is with the dev version. With the standard version, y was getting the same error on other line number. How could I fix my problem? I need to show comments and comment form separated from the node content.
Thanks.
Comment #52
pixelpreview@gmail.com commentedsame problem, it's effectively a cache problem because i use authcache to increase the speed of authenticated users on my site.
when i switch off authcache module, ajax comment works
I will try some paths in the settings of authcache module to desactivate cache for ajax comment
hum
I have try a lot of path :
ajax_comments/*
ajax_comments
*/ajax_comments/*
ajax_comments/instant_delete/*
ajax_comments/js
ajax_comments/js*
ajax_comments/js_reload/*
to exclude from cached page for authcache
always :
have you an idea of another path to exclude ?
Comment #53
halfiranian commentedSubscribing, same issue. But I don't have authcache installed
Comment #54
stephencarr commentedSubscribing. I have authcache installed and eAccelerator on Drupal 6.13.
If I turn off the cache everything works just fine.
It's a real shame because the commenting is so nice when it works, hopefully someone is going to find out how to fix this.
Comment #55
v8powerage commentedIn my case it's happenning only when after deleting comment tries add a new one without refreshing page first.
Comment #56
akongz commentedAfter install the 6.x-1.x-dev. Its fine..
But after I install http://drupal.org/project/comment_form_above_comments
The problem "array_shift() [function.array-shift]:" It's show again...
How to fix this..?
Thanks
Comment #57
gregstout commentedMaybe this will help: This module was working fine. We had a user request come in to change the "save" button name. Using form_alter, I changed the "Save" button to "Post" (
$form['submit']['#value'] = "Post";) and started seeing this exact popup error ("An error occured .. /ajax_comments/js"). I changed my "Post" button back to the original "Save" and the error went away.I know the error for this thread stated they were using the original "Save" button label so it won't solve it, but it might help others. Not sure how this submit value might affect the code, but it removed the error for me.
Comment #58
ltwinner commentedIve been looking at the code and it seems when you click on save on an internal comment the $form variable on line 106 doesn't get filled. If you just post your comment in the standard comment form this variable does get filled on line 106.
Anyway that's why it can't do the array shift, because there is nothing in the $form['#parameter'] variable to shift as the $form variable itself is empty.
Comment #59
ltwinner commentedBeen looking more at it and went into the form_get_cache function which in turn calls the get_cache function. On line 26 of cache.inc there following code is run
$cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {". $table ."} WHERE cid = '%s'", $cid));The $cache variable created here differs depending on if I am submitting with the standard comment form (which works) or if I am submitting with an internal comment form (which doesn't work and gives the array_shift error)
It's too big to print as when I submit the standard comment form the $cache['data'] variable is about 2300 characters long. However when I submit an internal comment form the $cache['data'] variable is about 170000 characters long. So something has to be going wrong here. I have no experience with drupal's cache handling so there isn't really anymore I can do. Maybe someone with more knowledge of this area could have a look at it.
Comment #60
tevih commentedAlso running Drupal 6.13 on a clean install, no memcache and sill getting the error. It pops up for me after I delete a comment and try to post another.
Comment #61
neochief commentedHooray, I was able to reproduce it with cache minimal lifetime set.
Comment #62
neochief commentedOkay, released a new version. To upgrade:
1. Remove old module's instance completelly from your modules folder.
2. Download 1.8 version and place it in modules.
3. Flush drupal caches.
4. Go to your nodes and try ajax comments.
If error persists, give me your drupal version, cache settings and is the any cache module are enabled at your site.
Comment #63
ltwinner commentedNice work mate, what was causing the error in the end, was it due to other modules interfering with cache?
Comment #64
v8powerage commentedUpdated to 1.8 and added comment and when tried delete it (w/out page refreshing), got error "Sorry, token error."
Comment #65
neochief commented-Shaman-, Flush caches, reload the page. Error should gone. I bet you had outdated page.
Comment #66
v8powerage commentedI truncated cache tables at phpmyadmin, which always does the job, then reloaded page.
Comment #67
CanOne commentedhi
the preview function works fine
but i cant save the comment
nothing happens if i click the button for saving!?
that problem also with newest dev version..
Comment #68
dimitriz1 commentedAjax comments is fixed!!! Very nice work neochief, this is one of my favorite drupal modules, great to see it working again!!
Comment #69
Jonah Ellison commentedFor those using third-party caching systems such as Memcache, CacheRouter, Authcache, etc, this patch may help:
http://drupal.org/node/395394#comment-1987804
Comment #70
gauravkhambhala commentedHi,
I have Drupal 6.10 and it's not a fresh install it's an upgraded one. I have tried both versions dev as well as stable. But the problem still persists.
It results in following:
I have no cache enabled. Can you address this ?
Comment #71
flyinghorse commentedHi,I have the same promblem with 6.x-1.8 2009-Aug-26 ,can somebody help ?
Comment #72
v8powerage commentedAfter experimenting with this I found that cache must be completely disabled at /admin/settings/performance otherwise the error will persist.
Comment #73
flyinghorse commentedthe cache are all disabled,and the module still can not work ...May be it's the time to disable this module until the problem be sloved......
Comment #74
flyinghorse commentedthe cache are all disabled,and the module still can not work ...May be it's the time to disable this module until the problem be sloved......
Comment #75
neochief commentedYes you should disable it for your site, if you're not able to describe step-by-step reproducing routine.
Comment #76
godewebog commentedGreate module, but the same problems on submitting, replying, editing comments (however comments deleting workgin fine) :(
Here is the outline of conditions:
drupal 6.14, cck, views, disabled all caches, no installed any caches modules (except blockcache module), threaded comments view, bueditor, voting_api+voting up_down modules enabled for comments, button_style module enabled (it makes styled the forms buttons), flag module enabled (for node bookmarking feature).
Comment #77
ccshannon commentedSame problem(s) with 6.x-1.8, no cache modules installed.
In Firefox 3.5.5 for Mac, I submit a comment, the 'progress bar' goes eternally and the comments don't update. Reload page and comment is posted. This happens in my custom theme, in Garland, with Dev module turned off. With all caching enabled or disabled.
In Safari 4.0.3, with normal caching on and block cache enabled, I get the:
I disable the cache, reload the node that has the comment form on it - notice my previous comment DID make it to DB and is on the page, and try posting a comment again.
I get a js alert box:
I hit the OK button and the 'progress bar' runs eternally.
THEN, I turn off a custom module we have running that replaces form buttons with images. Much like 'button_style'.
Suddenly, it works! (though it's putting new comments at the bottom of my date desc comment display instead of at the top, but that's a different issue.)
I turn all my caching back on, and it still works!!!
So, the issue seems to have as much to do with the replacing of buttons as with anything.
@godewebog - try disabling button_style and see if the comments posting works.
Comment #78
neochief commentedChris, you're Awesome! It's certainly can be root of evil. Could you please attach here part of your module which prevents ajax comments from working?
Comment #79
ccshannon commentedThanks, Alexandr. Your friendly words prove you're not my ex-wife!
The custom module (imgbutton) is just a form_alter hook function. Here are the parts that pertain to the comments form:
Which results in the Save button being replaced with an image and the Preview button disappearing. I wonder if the problem is from unsetting submit #value.
Anyway, I hope this helps!
Comment #80
chilic commentedThis error does not fixed.
After submit error:
And after preview error:
I used last version FCKeditor and memcahed.
Comment #81
ccshannon commented@chilic: If you turn off the FCKEditor for your comment form, just use plain textarea, do you still get the error? Are you replacing any of the form's buttons with images?
I'm not using a cache module, nor am I using a WYSIWYG implementation for my textarea. I got the same error. For me, the difference was that I have image buttons instead of standard buttons on my form. Putting them back to standard, the error goes away and the comment posts onscreen.
Comment #82
chilic commented@ccshannon: I turn off the FCKEditor for comment form, use standart resizable textarea. And no image button. =(
Comment #83
chilic commentedI disable memcahed and module is work! But how to use them together?
Comment #84
asak commented@chilic - I don't have much experience with memcached, but possibly cache_exclude.module could help...
Comment #85
calte commentedI changed title to 119, thats what recent post are specifying.
I'm getting this error when this module is used with Comment Block.
Any ideas?
Comment #86
calte commentedSimilar to #748234: Compatible with Ajax Comments for me.
When I click Save the button greys out for a moment then become clickable again. The error only happens when the button is clicked twice. I think the problem is that the Comment Block is not being refreshed.
Thoughts?
Comment #87
mauritsl commentedI'm getting this error in combination with memcache.
The problem seems to be that ajax_comments_cache_get() doesn't return anything. This function reads the cache directly from the database instead of using the cache_get function Drupal provides. Replacing the function body with the following line fixed the problem for me:
return cache_get($cid, $table);I do not understand why the cache_get from Drupal core is copied to this module..
Comment #88
bertboerland commentedcould the mantainers look to "patch" in 87?
Comment #89
homoludens commentedI have had this errors and everything started working after disabling "Comments Bonus API" module.
Using AJAX Comments 6.x-1.8.
I will report back if something changes.
Comment #90
ember5000 commentedI had this same issue twice, but I was able to fix it both times. Possibly this will help some people fix theirs as well.
The first time, I had installed the comment_form_above_comments module. If the module was set with the option 'Display comment form above comments, but below body', there would be one comment form, and it would give me the array_shift() error in the watchdog log whenever I tried to save/preview a comment. If I changed the setting to 'Display below post or comments' it would show two comment boxes. One above the comments section (that would throw the same error), and one below, that would work. (Delete, Reply, Edit, etc. buttons were not working as ajax either - they would just bring me to the separate form page).
Once I disabled the comment_form_above_comments module it worked perfectly.
The second time I got this error message while I was trying to move the comment box above the comments. I used a theme file override of the comment-wrapper.tpl.php file in the comment_bonus_api module. At first it didn't reorder these two section at all. It turns out it was because I had already defined a custom function that was overriding the comment_wrapper function (phptemplate_comment_wrapper($content, $node) in my template.php file). I removed this function, cleared the performance cache, and suddenly the array_shift() error was back. Granted, this time the comment form was above the comments, so at least it was using the proper comment-wrapper.tpl.php file.
It turns out that the issue is with the comment-wrapper.tpl.php file in comment_bonus_api (which I had simply copied and rearranged). The ajax_comments.js file in the ajax_comments module relies on two default wrappers that are automatically added by drupal (<div class="box"> and <div class="content">). However, comment_bonus_api's comment-wrapper.tpl.php file doesn't include these <div>s at all. In order to fix the problem I just needed to add these in.
So, if you want ajax_comments to work with comment_bonus_api, you will need to copy the default comment_bonus_api comment-wrapper.tpl.php file into your current theme, then replace what's in there with this:
(Don't forget to refresh the Performance (/admin/settings/performance) cache, or it won't pick up the file.)
Comment #91
rjbrown99 commentedCan someone try this with the latest -dev release and let me know if it is still a problem? There were previous fixes for caching and other minor issues that may have resolved this. I'll leave it open pending some additional feedback.
I'd prefer if you could also provide feedback if you are using a caching engine or not, and if you are using a standard textarea or a different javascript editor like CKeditor, etc. Thanks.
Comment #92
akalata commentedDev version helped me avoid the the line 119 error by blocking out the whole comment box while the initial comment was being submitted. Helps avoid the double-press error! No caching that I know of (not sure what's server-side), no RTE.
Comment #93
marvix commentedI am geting this problem also, the error shows up when I post the comment, and after I re-post the same am getting the error!
Comment #94
marcoka commentedi have that bug too. enabled. try to post . error
Comment #95
amedjones commentedfor those having this issue. Activate "Threaded list - expanded" under comment setting for that particular node type.
Comment #96
blainelang commentedWhen previewing the new comment, I was also having this issue "warning: array_shift() [function.array-shift]: The argument should be an array ..." - building a D6.20 site with version 6.x-1.8 of Ajax comments.
The implementation was on a custom content page where I used drupal_get_form('comment_form', array('nid' => $variables['nid'])) to generate the comment form.
Tried adding the extra div containers as noted by @90 but that did not solve my issue. What did was editing the content type and disabling the preview. I tried all the other comment settings and any combination with the 'preview' button enabled resulted in this error. The AJAX form still shows the preview and it's working.
Still see the issue if I try to post a second comment with out refreshing the page.
Has anyone successfully embed the AJAX driven comment form on a page using the drupal_get_form or have any insight into how I solve the array_shift error I get on the subsequent comment post?
Comment #97
kip stanning commentedhi neochief,
great work you accomplished! love your module and so far it works perfectly!
regards to ukraine!
karl from vienna forest
Comment #98
rjbrown99 commentedComment #99
SewFresh commentedi can confirm this module doesn't play nice with comment_form_above_comments module
Comment #100
msathesh commentedAjax comments doesn't go good and work with nodeformssetting module. Ajax comments works fine without nodeformssetting but when I enable the module it just put up the error "An error occured /ajax_comments/js". Hope this helps someone.
Comment #101
manjeet commentedThanks, this resolved my problem.
Comment #102
grotto commentedCaching should be set to ON always, because ajax_comments depends on caching to work. Why this isn't in the mainline yet is ridiculous.
In some cases form caching is disabled. Not sure what causes that. Could be that I'm using boost module and I have disabled caching during development.
This patch works perfectly for me.
Comment #104
qzmenkoComment #105
qzmenkoIssue is closed because 6.x version is unsupported. Feel free to open new issue for 7.x or 8.x versions of module.