Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
An error occurred. /drupal/content/js_add_more/story/field_noderef <br />
<b>Fatal error</b>: Cannot use string offset as an array in <b>/var/www/drupal/sites/all/modules/aef_formatter_selector/aef_formatter_selector.module</b> on line <b>212</b><br />
Comments
Comment #1
ndeschildre CreditAttribution: ndeschildre commentedHello,
Hmm interested! How do you trigger that?
Comment #2
dellis CreditAttribution: dellis commentedI get an error as well when trying to "add more" as well, only once I installed Formatter Selector...
"An HTTP error 500 occurred"
This module is awesome--I really hope this is a small fix!
Thanks
Comment #3
dellis CreditAttribution: dellis commentedMore detail and clarification on the error that I seem to have replicated... I've added the formatter selector to a CCK nodereference field (one that allows unlimited values) and it looks like things work perfectly when only one value exists--the preview of the node looks great and changing the formatter adjusts the look of the field; saving the content properly saves the formatter value to the db as well. The problem occurs when you try to "add another item" for that nodereference field. Regardless of which nodereference field you try to add another value to (whether it has a formatter or not--as long as there is a formatter on the page), it throws a pop-up error: "An HTTP error 500 occurred" and the path is "content/js_add_more/mycontenttype/myfield." Firebug translated this into a "500 Internal Server Error" which didn't tell me much more.
After checking the webserver's error log I found this:
Cannot use string offset as an array in /var/www/vhosts/mydomain.com/httpdocs/sites/all/modules/aef_formatter_selector/aef_formatter_selector.module on line 212, referer: http://www.mydomain.com/node/add/mycontenttype
The line in your module file is from this function: function aef_formatter_selector_modify_element(&$form, $field_id, $delta, $options = NULL)
The specific line referenced is: $form[$field_id][$delta]['formatter']['#prefix'] = '
When I disable the formatter selector module the add more works as advertised. Perhaps there is a function/variable name that is already being used by another module/or drupal core?
Comment #4
ndeschildre CreditAttribution: ndeschildre commentedHello and thanks for the debugging!
Helps a lot.
I have tried on both CCK 2.2 and CCK 2.6, using Drupal 6.13, and I was not able to reproduce: Clicking on the "Add more" button of a nodereference with formatter selector works as expected.
So I'm suspecting a slight API change, either in CCK or Drupal, more probably CCK, that trigger the bug. Are you by chance using CCK 3?
I'd like as much infos as possible on your current setup so that I can reproduce and make it work on all setups.
Thanks,
Cheers,
Nicolas
Comment #5
dellis CreditAttribution: dellis commentedNo problem. Thank YOU!!
Yes, I needed to have CCK multigroup so I'm using CCK 3
I'm also using D6.15 and Jquery 1.3.2 (if that helps).
Your suite of modules is amazing. Really Really powerful. Thank you for sharing, and thanks for your help with this...
Comment #6
dellis CreditAttribution: dellis commentedFollow up: I've down-graded to CCK2.6 and now when I load the "Edit" page, there is an additional blank field (on the multiple fields) available for me to populate. Everything looks good (multiple formatter-types with multiple previews) but again, when trying to click the AHAH "Add More" it gives me:
PHP Fatal error: Cannot use string offset as an array in /var/www/vhosts/mysite/httpdocs/sites/all/modules/aef_formatter_selector/aef_formatter_selector.module on line 212
When I save the page and come back into the edit version again, it does add another field, but the add another button still doesn't work... Very strange...
Comment #7
ndeschildre CreditAttribution: ndeschildre commentedHello,
Ok, since I cannot reproduce, could you give me an hand at debugging it, using CCK 2.6 please? (I'm suspecting another contrib module influence here)
On line 212, before the offending line, could you put:
echo $field_id . "-" . $delta;
print_r($form[$field_id][$delta]);
and give me the output please?
Note: Before clicking the "add more" button, activate the network panel of firebug. Click the button, let the error come. Then look into the POST response part: you will see what the server answered.
Thanks!!
Comment #8
ndeschildre CreditAttribution: ndeschildre commentedAlso, if you could give me the list of modules you installed...
I would really find to find out this node structure that makes formatter selector fails here.
Comment #9
ndeschildre CreditAttribution: ndeschildre commentedI have released the 1.2 version with a tentative fix against this problem.
Please test (with CCK2) and tell me if it works :)
Cheers,
Nicolas
Comment #10
dellis CreditAttribution: dellis commentedSure thing. I will try shortly! Thanks!
Comment #11
dellis CreditAttribution: dellis commentedFantastic! Version 1.2 seems to have done the trick! You have made my day!! Thank you.
Comment #12
dellis CreditAttribution: dellis commented