Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm getting an error every time I try to change settings on the performance page:
FormAPI Bug Encountered; Try Again
Also, strange text on all buttons in settings pages. See attached.
Comment | File | Size | Author |
---|---|---|---|
#50 | boost-adminform-630000-50.patch | 1.15 KB | tangent |
#47 | screen20120705a.png | 128.07 KB | gregarios |
#45 | boost-adminform-630000-45.patch | 4.17 KB | tangent |
#6 | boost-630000.patch | 5.16 KB | mikeytown2 |
boost_settings_errors_02.png | 7.69 KB | gregarios |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedI added in that text, as a way to detect when Drupal wasn't firing the right function behind the button. I mainly encountered the error when the crawler was running; in short I would press the stop crawler button and there was a random chance the "Clear all Boost cached data" button would be pressed. If the number on the button doesn't match the number in the function, then it aborts. I have yet to file a bug with this because its kinda hard to reproduce.
What setting are you trying to change?
Comment #2
gregarios CreditAttribution: gregarios commentedIt doesn't seem to matter what settings I try to change. I get the error every time I push any button on that page.
Wait... now they all are working except the "Clear Boost's Database & File Cache" button. Sorry.
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commenteddoes it happen when you press the save button?
Comment #4
gregarios CreditAttribution: gregarios commentedSave works fine. It seems to be just the "Clear Boost's Database & File Cache" button that does it every time.
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentedI'm currently looking into the drupal.org issue queue for answers for the bug. If you downgrade core to 6.13 the bug seems to go away (according to these threads).
#302240: button broken due to fix various problems when using form storage
#591696: Problem with various AHAH forms and validation
#206955: image_button: clicked_button value is wrong
In the mean time, I might be able to work around the bug; I'll keep you updated.
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedComment #7
mikeytown2 CreditAttribution: mikeytown2 commentedcommitted above patch
Comment #9
AlexisWilke CreditAttribution: AlexisWilke commentedI got this message today with the newest version (installed a few hours ago):
FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4.
I did apply the upgrade, and as mentioned by the previous person who reported the problem, I got the error when clicked "Clear Cache". I did not do a "Save" yet... Okay, I did a "Save" and tried the "Clear Cache" again and same error. So something's going on.
Is there something I can test to find out the problem/reason for that FormAPI bug?
Thank you.
Alexis
Comment #10
mikeytown2 CreditAttribution: mikeytown2 commented@AlexisWilke
What version of Drupal are you using?
The operation did what you wanted correct?
Comment #11
AlexisWilke CreditAttribution: AlexisWilke commentedMikey,
I have the latest: Drupal 6.14. Just in case, I updated the Version of this issue since it "breaks" in the 1.x-dev. (it was set to 1.15)
It looks like all the files were deleted, yes. So the operation did what I was expecting. Testing the site, I got the pages refreshed since it started showing the right things.
Thank you.
Alexis
Comment #12
mikeytown2 CreditAttribution: mikeytown2 commentedTry Drupal 6.16. It's a bug with core; With boost I bypass the core bug. But when I do that, I throw an error message up letting you know what happened. So in your case, you selected button #4 but Drupal said you selected button #0. Boost sees the mismatch and fixes it.
Comment #13
sinasalek CreditAttribution: sinasalek commentedStill exists in Drupal 6.16
Comment #14
mikeytown2 CreditAttribution: mikeytown2 commentedhmmm, well at least the correct action is happening.
Comment #15
jimcaruso CreditAttribution: jimcaruso commentedStill exists in 6.17
Comment #16
sinasalek CreditAttribution: sinasalek commentedStill exists in 6.17 confirmed
Comment #17
AlexisWilke CreditAttribution: AlexisWilke commentedI've not gotten that error in ages, but i don't have a 1 to 1 Drupal Core version... Yet I had that error before so I would think it is gone (for me).
Comment #18
hedac CreditAttribution: hedac commentedin dev... it seems all working ok but I get the error displayed... what the error means? Should I worry?
Comment #19
mikeytown2 CreditAttribution: mikeytown2 commentedmeans there is still a bug in formAPI in core. don't worry, I don't have the time to track in down in core so I worked around it.
Comment #20
aiphesidem for me on 6.19 : FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4.
could be the source of my issue on displaying a empty page instead of a table whith images in ?
http://www.lycee-le-rocher.com/les-formations-du-lycee
Comment #21
lizac CreditAttribution: lizac commentedI think this issue is still present on Drupal 6.19. I received this error -
FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4.
and these when trying to add more options on poll - an Http 403 error occured in /poll/js so I checked the dlog and it gave me this error
{ "status": true, "data": "\x3cdiv class=\"messages error\"\x3e\n \x3cul\x3e\n \x3cli\x3ewarning: array_shift() [\x3ca href=\'function.array-shift\'\x3efunction.array-shift\x3c/a\x3e]: The argument should be an array in /modules/poll/poll.module on line 332.\x3c/li\x3e\n \x3cli\x3ewarning: call_user_func_array() [\x3ca href=\'function.call-user-func-array\'\x3efunction.call-user-func-array\x3c/a\x3e]: First argument is expected to be a valid callback, \'\' was given in /opt/va/www/cms/includes/form.inc on line 376.\x3c/li\x3e\n \x3c/ul\x3e\n\x3c/div\x3e\n" }
can anyone help? Thanks!
Comment #22
osalcedo CreditAttribution: osalcedo commentedI'm using Drupal 6.19 and Boost 6.x-1.18
I disabled the Performance Logging module under Development and the "FormAPI Bug Encountered" error disappeared.
Just an FYI... I tried to enable the Performance Logging module without first having APC installed on my server. So I'm not sure if that was a contributing factor. Either way the error went away when I disabled the module.
Comment #23
lizac CreditAttribution: lizac commentedHi! resq935.
I actually don't have the Performance Logging module under Development. Can you elaborate more?
Thanks!
Comment #24
MattFielding CreditAttribution: MattFielding commentedsubscribing
Comment #25
osalcedo CreditAttribution: osalcedo commented@lizac I truly do wish I had more to offer other than disabling that one module.
Comment #26
lizac CreditAttribution: lizac commented@resq935. No problem. Your comment here is truly appreciated.
Unfortunately, I'm still dealing with the issue and just leave it for a while. Hopefully, we could get more info when I'm ready to face it again. =(
Comment #27
TheoRichel CreditAttribution: TheoRichel commentedI do not have the performance module enabled, but I do receive this error.
Comment #28
superflyman CreditAttribution: superflyman commentedWhen running Clear Boost's Database & File Cache, the system hangs for a while and then comes back with 'FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4.' I am using 6.19. Is there any way around this? Does the Dev version solve this problem? I see this was closed but I'm still having this problem with 6.x 1.18. We desperately need to clear out all of the database records and CSS and would like to keep using this module. Any help appreciated. Thanks!
Comment #29
naero CreditAttribution: naero commented+1 Re:#28 .. me too.
Comment #30
mikeytown2 CreditAttribution: mikeytown2 commentedFor CSS/JS issues I've been working on a new project.
http://drupal.org/project/advagg
The button should still work... It works around a core bug.
Comment #31
SchwebDesign CreditAttribution: SchwebDesign commentedsubscribing, getting the same "FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4." message, but the system doesn't necessarily "hang" for me, not that i can tell. subscribing.
Comment #32
AlexisWilke CreditAttribution: AlexisWilke commentedFYI, I got that error today. It was when I ran a full Cache Clear of the entire server (which I did not mean to, btw, and an intermediate window that tells people exactly what will happen and confirmation would be nice.)
Anyway, this being said, I do not see a problem in the output, just that unusual message at the top.
Thank you.
Alexis
Comment #33
alexbk66- CreditAttribution: alexbk66- commentedI get it too, Drpal 6.20
subscribing
HobbyBlob.com
Comment #34
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedI get it with Drupal 6.20
Comment #35
Cosmy CreditAttribution: Cosmy commentedI'm getting it too and I'm using pressflow.. never happende before today, and i've not installed any more module..
Comment #36
deomurari CreditAttribution: deomurari commentedI get it with Drupal 6.20 with pressflow
Comment #37
aliensun CreditAttribution: aliensun commentedDrupal 6.22
subscribing
Comment #38
jvieille CreditAttribution: jvieille commentedDrupal 6.22
Comment #39
tran_tien CreditAttribution: tran_tien commented+1 sub. I meet this notice too, on this site : Xem bong da truc tuyen
Comment #40
gregaltuna CreditAttribution: gregaltuna commentedBump. I'm getting this bug, too. Subscribing.
Drupal 6.25
Comment #41
jami3z CreditAttribution: jami3z commentedso a 3 year issue still exists with no solution yet?
thats awesome.
Comment #42
gregarios CreditAttribution: gregarios commentedComment #43
tangent CreditAttribution: tangent commentedI respectfully suggest that if boost is able to reliably work around this core issue then there is no reason to display an alarming warning to the user.
I haven't examined the work-around code but if it detects both the expected form post and the current buggy form post and it is expected that boost will "do the right thing" even if the core bug is fixed then there is no reason to needlessly alarm users about the core bug and the warning can be removed. If that isn't the case then perhaps the work-around logic can be improved to handle both scenarios so that the warning message can be removed.
Comment #44
bgm CreditAttribution: bgm commentedI have to admit that I have a hard time understanding the issue, and as it happens often, an issue kind of drifts into something else.
Can someone write a short summary of:
- the problem,
- steps to reproduce it, and how systematic it is to reproduce,
- the proposed solution,
- if there are any side effects to the proposed solution ?
Thanks
Comment #45
tangent CreditAttribution: tangent commented@bgm, it seems that this issue has morphed from a core bug to a complaint with the "FormAPI Bug Encountered; trying to work around the bug. Given: %given Wanted: %wanted." warning message generated by Boost. I am partly to blame here, with my previous comment. Perhaps this ticket should remain closed and a new ticket about the warning should be opened.
Nevertheless, I'm going to comment on the warning complaint here until I hear otherwise. I do not believe that the core FormAPI bug exists any more. I'm not sure what it was but I've removed the button router logic which was added to work around the bug and the form works flawlessly, without the offending message.
Attached is a patch which works great for me.
Comment #46
bgm CreditAttribution: bgm commented@tangent: thanks for the update and patch, much clearer now.
Seems a bit risky to remove all the error checking code. If people are still running into the warning, doesn't it mean that the bug still exists? (or are they running an old version of core?)
In the mean time, I would rather only transform the drupal_set_message() complaining about the error into a watchdog message. See commit f74a90bd5508b346bc9fbf54810f34141c57d620.
People who run into the message should post what button they pressed, and what was the error message. From the only post that does mention it, it seems like the code did what it should (catch a FormAPI bug) and re-routed the action correctly, i.e. flush cache.
EDIT: to be more specific, I removed the first "trying to work around.." message, but left the "try again" if it failed. From the latest comments, it seems that people are not running into that issue.
Comment #47
gregarios CreditAttribution: gregarios commentedThe bug is indeed still there using Drupal 6.26 and Boost 6.x-1.20 (unpatched), with all caches completely cleared or not.
If you push the
"_4 Reset Button - Database Records: XXX, Files: XXX"
button, it gives the error message for me.See attached screenshot.
Comment #48
tangent CreditAttribution: tangent commented@gregarios, it is not an error you are seeing but a warning message. It is not in question that the warning is present.
@bgm, like I said, I'm not sure what the core FormAPI bug was. The issues linked to in comment #5 seem to be fixed or for future Drupal versions. Each submit button has a different callback and in my testing each button calls the correct associated callback and only that callback. Each submit callback executes that global button router function though and button router merely checks if there is a value (button text), which will always be true so the warning is displayed.
Removing all that code, per my patch, each callback is executed when the associated button is clicked. There is no FormAPI bug as far as I can tell with Drupal 6.26.
Comment #49
gregarios CreditAttribution: gregarios commentedNo problem. I just was reaffirming that the Boost page does report that "a bug was encountered," which to me is a warning about an error, if not an "error message" per se.
IE: A bug is an error or it wouldn't be a bug. If it isn't an error-bug, then it is a purposeful-bug, which is an "Easter Egg." ;-)
Comment #50
tangent CreditAttribution: tangent commented@bgm, sorry, I missed the part about your new commit. If the warning messaging must remain perhaps we could do a version check so it doesn't need to display for the current Drupal version where the bug does not exist?
Comment #51
bgm CreditAttribution: bgm commentedAs much as I'd like to remove this code, gregarios mentions running into this issue with Drupal 6.26, so I tend to disagree with the patch in #50, although I can't reproduce the bug.
In the screenshot posted in #47, boost caught the bug and correctly executed the correct action, so seems to me like the code is working OK, and removing the first warning is sufficient.
@tangent: do you see any inconvenience in leaving the code as is? (e.g. without the first drupal_set_message for when boost correctly handles the bug)
Comment #52
mikeytown2 CreditAttribution: mikeytown2 commentedRemove the warning. Bug is with core and I don't see that getting fixed. Message is mainly a debugging thing.
Another way to not have this bug happen is to only have one button in each field group. If you have more than 1 button in a field group the bug appears sporadically. Its a bug with core from what I've seen.
Comment #53
bgm CreditAttribution: bgm commentedThanks Mike. So the latest commits should be good enough.
I'd rather not make big changes to 6.x-1.x if not really necessary, and focus on 7.x-1.x.
Marking issue as fixed.
Comment #55
ataliba CreditAttribution: ataliba commentedHere I had the same error on Drupal 6.23
FormAPI Bug Encountered; trying to work around the bug.
Comment #56
Katharine_Gates CreditAttribution: Katharine_Gates commentedGetting this message on "Clear Boost's Database & File Cache" on Drupal 6.33 and Boost 6.x-1.21
"FormAPI Bug Encountered; trying to work around the bug. Given: 0 Wanted: 4. Are you running an old version of Drupal core? For more information, see: http://drupal.org/node/630000. Please describe which button was clicked and the complete error message."
Comment #57
Anonymous (not verified) CreditAttribution: Anonymous commentedI believe the error message request "which button was clicked" ?
Comment #58
Katharine_Gates CreditAttribution: Katharine_Gates commentedThe button I clicked was "Clear Boost's Database and File Cache" (not obvious? that's the name of this issue, right?)
at the bottom of this page: admin/settings/performance/boost