CTools Delegator causes error in hierarchical_select_json()
| Project: | Hierarchical Select |
| Version: | 6.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Wim Leers |
| Status: | closed |
Hi,
I often seem to have the same error when selecting HS parent and child, in fact when I select it will just hang and the following in error reports:
Error 1:
Location http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/node/add/article
Message Missing argument 2 for drupal_retrieve_form() in /home/mysite/public_html/includes/form.inc on line 320.
Error 2:
Location http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/node/add/article
Message call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in /home/mysite/public_html/includes/form.inc on line 366.
Error 3:
Location http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/node/add/article
Message uasort() [function.uasort]: The argument should be an array in /home/mysite/public_html/includes/common.inc on line 2832.
As far as I know I do not have hierarchical_select_json in the base of my site. Is there perhaps a reference that is incorrect the HS?
Look so forward to hearing from you with any solution to this please ..
Lilian

#1
I get exactly same error and behaviour on Drupal 6.9 with the latest dev.
In fact HS preview form on Vocabulary settings page works perfect, but when creating a node, neither selection, nor create new term works.
I am not sure if there was an older 6.x dev version but I seem to remember that this was working previously, though I am not sure if it was HS for menu or taxo.
Thank you for a great module.
#2
Minor retouch sorry, compacted title a bit to include more...
#3
Ok, I checked form post with Firefox' Tamper plugin and here it is:
Request Header seems intact:
Host=*masked*User-Agent=Mozilla/5.0 (Windows; U; Windows NT 6.1; tr; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6
Accept=application/json, text/javascript, */*
Accept-Language=tr-TR,tr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding=gzip,deflate
Accept-Charset=ISO-8859-9,utf-8;q=0.7,*;q=0.7
Keep-Alive=300
Connection=keep-alive
Content-Type=application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With=XMLHttpRequest
Referer=http://*masked*/node/add/book
Content-Length=636
Cookie=SESSd729b2c5896fba93e1ee6498665c618c=34hk99qnb204aik068pv0esqb3; __utma=243067463.1896780305.1233497075.1233748773.1233757369.3; __utmz=243067463.1233497079.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=243067463; has_js=1
Pragma=no-cache
Cache-Control=no-cache
POSTDATA=hs_form_build_id=hs_form_3b5a01393921811d16c2d342e6af1721&changed=&form_build_id=form-db124bb6e15d14187eb38e495f97f4cf&form_token=25d4750beb75dad29020ffb96112c8d0&form_id=makale_node_form&domain_site=1&domains%5B-1%5D=-1&domain_source=0&iid=0&files%5Bimage%5D=&image_title=&book%5Bbid%5D=0&book%5Bplid%5D=-1&book%5Bweight%5D=0&taxonomy%5B7%5D=&taxonomy%5B2%5D%5Bhierarchical_select%5D%5Bselects%5D%5B0%5D=11&title=&teaser_include=1&body=&format=1&files%5Bupload%5D=&menu%5Blink_title%5D=&menu%5Bparent%5D=navigation%3A0&menu%5Bweight%5D=0&log=&comment=2&pathauto_perform_alias=1&path=&name=BigBrother&date=&subscriptions_notify=1&hsid=1
And the unfortunate response header;
Status=Internal Server Error - 500Date=Thu, 05 Feb 2009 13:50:21 GMT
Server=Apache
Expires=Sun, 19 Nov 1978 05:00:00 GMT
Last-Modified=Thu, 05 Feb 2009 13:50:21 GMT
Cache-Control=store, no-cache, must-revalidate, post-check=0, pre-check=0
Vary=Accept-Encoding
Content-Encoding=gzip
Content-Length=20
Connection=close
Content-Type=text/javascript; charset=utf-8
Something fatal happens as we see error 500. Any experienced eyes there?
Tx.
#4
Changing status...
#5
subscribe
#6
subscribe...I get the same problem/error
#7
Hi all again, may be some good news,
Anyone using Panels 3 dev module with Ctools Delegator enabled?
I disabled "only" the Delegator and voila! A miracle happened and HS worked prefectly.
Check my another issue on http://drupal.org/node/352804#comment-1241196 and http://drupal.org/node/367213#comment-1242805 which seem very very related to me, and if this is your case also, please inform Ctools.
Tx.
#8
Chawl...I can confirm this.
But then panels doesn't work
#9
Unfortunately Delegator screws up every bit of JS functionality on edit pages, not only HS.
I think this is not a main HS issue anymore.
#10
if correct, what would be the plan of action? I'm a newbie so not sure where to take this next?
#11
Downgrade to panels 2 for now. Obviously not the optimal solution, but hey. Post in the ctools issue, who knows which side the problem lies.
#12
I can not find an immediate workaround myself and disabled HS, and fallback to standart select fields unfortunately.
Anyway, as preview page retains some functionality back, that may fix some HS features.
It is also plausible to check http://drupal.org/project/issues/ctools?states=all Ctools issue page frequently.
May it be easy!
#13
In my first post of this thread, still have this error, but not using Panels or Delegator ...
#14
Check this on http://drupal.org/node/336517
May be related with teaser.js issue somehow and might help.
HS is a must anyway.
#15
As Panels is one of the most commonly used modules and announced to discontinue 2.x and decided to rely on 3.x version which uses Ctools/Delegator for the future, HS/Delegator issue has to be solved.
Unfotunately nobody knows which side causes the problem, but I'd like to reanimate this thread.
You can also check the counter issue on http://drupal.org/node/370487
Tx.
#16
If you can set up a demo site for me with admin + FTP/SSH access then I'll give it a look. If I have to create the test case myself, this will stay at the bottom of the pile that is my todo list. I've got limited amounts of time and time spent on reproducing the test case is time lost. Thanks for your understanding and thanks in advance for the demo site :)
#17
I have setup a test site and sent you the information from your contact form.
Thank you for your time :)
#18
Thanks for setting up the test site! I got your e-mail.
I've got 3 busy school days now, I probably won't look at it before Friday.
#19
#20
Hi Wim,
Is it already clear, whether this is a HS issue, or a Delegator issue?
For me this is the hold up to go live with a site on D6.
Thanks a lot in advance for your effort to get to the bottom of this!
Greetings,
Martijn
#21
Delegator obviously, because it works fine when you disable Delegator.
I'll probably have time this weekend to track this down.
#22
Thanks Wim! Looking forward to it.
Greetings, Martijn
#23
Thanks Wim. HS is the only way to go so I look forward to a solution when you do get the time. Clearly Delegator has caused issues with more modules then just HS, and that is unfortunate being it stands to be an integral part of many drupal installations going forward with the increasing desire of users to employ panels.
#24
Investigating this right now.
It seems Delegator empties
$_POST. No wonder that everything breaks…#25
I've got no clue why it stopped doing this, but all of a sudden $_POST was no longer empty.
In any case, this is due to the extra layer of indirection that delegator adds. HS assumes that the file for the menu callback is also the file in which the form definition function lives. This works for 99% of the cases. Exceptions are modules such as node_clone and … delegator. However, node_clone just had to add a
require_once(drupal_get_path('module', 'node') .'/node.pages.inc').Delegator really adds another (pretty abstract) layer of indirection. And thus it's up to Delegator to let us know where the function lives. merlinofchaos has agreed to fix this. The relevant issue is #416298: Delegator's extra layer of FAPI abstraction makes finding the form function impossible. You can also find a more detailed explanation there.
For now, I'm providing a patch (see the attachment) that you can apply manually. It's somewhat hacky, but it gets the job done. It only works when Delegator is applied to node forms (which is all it currently supports).
#26
Wim's patch in #25 WORKS FOR ME.
Apparently, you can have your cake and eat it too.
Thanks Wim.
#27
Hi,
Confirming on latest dev that patch works to have delegator and HS work together.
Thanks for now Wim!
Greetings, Martijn
#28
Hi,
The exact error only shows on my production lighttpd server. There's no error in my localhost using xampp (apache). wondering anything to do with that? Using the exact same database and contribute modules on both machines. I did not have Ctools or delegator installed btw...
#29
If you don't have CTools/Delegator installed, then please start a separate issue.
#30
Patch saved me a ton of headaches as well. Thanks.
#31
Just to inform, I checked in the delegator half of #416298: Delegator's extra layer of FAPI abstraction makes finding the form function impossible so that Wim can do the HS half.
Please continue using the patch workaround until Wim's half is done, though, as the real solution is still slightly more complex than the workaround.
#32
Thanks a lot merlin :) Much appreciated!
#33
subsribing
#34
Had to apply the patch with CTools dev as of 5/8/09, and HSis working fine now.
#35
Subscribing, please inform us/me when this is included into dev... Both panels and HS are needed for my D6 deployment.
#36
Patch works great, thanks Wim!
#37
Subscribing for updates.
Patch works thanks!
#38
Subscribing.
#39
Subscribing.
#40
subscribing
#41
Delegator issues as well, just a bit different codes
Posting it here for others via Druapl search
Windows error - invalid server request
Drupal error:
warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in /home/mysite.com/includes/form.inc on line 366.
warning: uasort() [function.uasort]: The argument should be an array in /home/mysite.com/includes/common.inc on line 2829.
workaround: disabled Delegator - works
going to try patch
comment: I had just merged 30 terms into parent/child before this happened, thought I had damaged that Vocab - so went and un-did the parnet/child - ouch!
lesson learned:
1) Stop everything
2) go to drupal search for error - to see if common
3) save headaches and lost of time :-(
#42
subscribe
#43
Is this patch working well enough to be added to a dev version?
I am still fighting with the PATCH situation (I use windows).
#44
its working here
#45
Hi,
Thought it was time to give HS and Delegator another try after my first post (on top).
I've added the patch and it works if the user is logged in, but not when the HS is on the user/register page.
There I would like the user to select a HS parent and child, but receive the same errors .. 'receiving an invalid response from the server'.
When I disable Delegator, it works, but then no panels3 (so it's one or the other :).
Look forward to any suggestion, and thank you.
Lilian
#46
Hi,
I think the answer has been in front of us all the time:
Error report:
Location http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/user/register
The HS is looking for hierarchical_select_json in public_html and not in sites/all/modules ...
with error
call_user_func_array() [<a href='function.call-user-func-array'>function.call-user-func-array</a>]: First argument is expected to be a valid callback, '' was given in /home/public_html/includes/form.inc on line 366.Am I perhaps on the right track?
Look forward to any reply, and thank you ..
Lilian
#47
not sure to log error here or in HS
but same error as #41 , so will start here
the error would appear and prevented any "move" changes to Drupal Core Menu
Workaround: turned off HS menu option
#48
Same issue here as in #28......but i have ctool. I cannot go without Ctools though (used by Advanced Profiles).
I patched HS with the workaround submitted, but still getting errors on remote server. When delegator is removed, everything work fine.
Any solutions, suggestions? Currently I am working without HS, but as you all know its not the same!!
thanks in advance
rc
#49
any one managed to work around issue #48...i am still testing and trying to find a solution...i appreciate recommendations...thanks
rc
#50
Hi, Have just installed the new Panels 3, which does not need Delegator, therefor uninstalled ... updated CSTools ..
Still same error :
http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/user/register
Message Missing argument 2 for drupal_retrieve_form() in /home/public_html/includes/form.inc on line 320.
So it's not Delegator that is causing the problem ..
#51
Just a quick update...I disabled all the options in the HS select module - except the HS taxonomy and seemed to work fine. I only needed HS for Taxonomy at this point.
#52
Thanks to merlinofchaos (see #31), it is now possible to fix this in a more generic way. Please try the new patch.
#53
Sorry, wrong patch.
#54
Hi,
Have just downloaded latest version 18 July, updated and then added the patch in #53
When a user tries to select a term at the register page, an error pops up with
"Received an invalid response from the server."
In error reports:
http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/user/register
Message Missing argument 2 for drupal_retrieve_form() in /home/public_html/includes/form.inc on line 320.
http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/user/register
Message call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, '' was given in /home/public_html/includes/form.inc on line 366.
http://www.mysite.com/hierarchical_select_json
Referrer http://www.mysite.com/user/register
Message uasort() [function.uasort]: The argument should be an array in /home/public_html/includes/common.inc on line 2843.
I do have Panels 3 installed, but disabled Delegator as it is not necessary for Panels 3 anymore ..
The strange thing is though, when the user is logged in, then is able to select an HS term. Only when they are trying to register it does not work.
Looking so forward to any reply, and thank you.
Lilian
#55
How did you add Hierarchical Select to the user registration form?
#56
Hi Win,
Sorry I seemed to have missed your response. Thank you so much for your reply :)
Using Content Profile and 'Use this content type on the user registration page'.
In admin/content/taxonomy/list > selecting 'directory' > edit vocabulary > Use the Hierarchical Select form element for this vocabulary.
I then select my content profile type which is 'profile'.
Save only the deepest term
Force the user to choose a term from a deepest level
Display the node count: Disabled
Resizable: Disabled
This vocabulary (directory) is the only one uses as HS on my site.
When a user edits in their content profile, HS works beautifully, and everything is good.
When a user is trying to register for the first time, and need to select a Directory with HS, receive error 'received an invalid response from the server'.
I'm using Firefox, but have also tried it with Safari.
Looking so forward to your reply, and again, thank you Wim.
Lilian
#57
So you are using Content Profile. There's a separate issue for that: #518830: Content Profile causes error in hierarchical_select_json().
This issue is intended solely for CTools. Please subscribe to that other issue and copy/paste your last comment over there.
Others: please test the patch in #53!
#58
OK, I've applied #53 and if I create a new field using Content Taxonomy on the same content type, nodes will not be saved in the specified term for that vocabulary unless a term is also specified for the Content Taxonomy field at the same time. It will be blank. BTW, I also tried it with: http://drupal.org/node/342992
#59
This patch in #53 works for me.
But why is it still not committed ?
Are there any other issues pertaining to it ?
#60
It was not yet committed because I didn't have any confirmation that it was in fact working. I'll assume one confirmation is enough.
So, I've committed it: http://drupal.org/cvs?commit=244418.
#61
Automatically closed -- issue fixed for 2 weeks with no activity.
#62
So noob, but how do I apply this patch?
#63
here, read carefully
http://drupal.org/node/60108
#64
Hi,
With latest upgrade of HS I experienced again the delegator error. Implemting the patch of http://drupal.org/node/368471#comment-1409770 worked for me.
This issue is in mine opinion still not completely resolved, so setting issue to active again.
Greetings,
Martijn
#65
Eh … that patch was committed ;) Are you sure you're using the latest version of HS?
#66
I have installed: Hierarchical Select 6.x-3.x-dev (2009-nov-01) and I needed to add this patch to get it working still.
Greetings, Martijn
#67
Then you don't have the latest version of delegator installed (see #31). Revert the patch and update Delegator and it'll work.