The error below occurs when I try to add a content to a content type with conditional fields present (text, long text and term reference) and where these fields have some field permissions set (using the field permissions module.)
The error is showing to users that do not have permission to edit the fields. Users with permissions do not see the error message - all works as normal.
Fatal error: Function name must be a string in /public_html/sites/all/modules/conditional_fields/conditional_fields.module on line 583
Removing the code below from the module c.line 583 seems to fix the problem, but heaven only knows what else I could be breaking!
// Execute custom behaviors.
if (!empty($behaviors)) {
foreach ($behaviors as $behavior) {
// Custom behaviors are callbacks.
$$behavior('edit', $form, $form_state, $dependent, $dependencies);
}
}
unset($behaviors);
(Addition...just found out that removing the above breaks quite a lot! Conditional fields elsewhere, available to anonymous user have stopped working...)
Comment | File | Size | Author |
---|---|---|---|
#22 | 1315366-incomplete-behavior-22.patch | 520 bytes | minorOffense |
#20 | 1315366-incomplete-behavior-19.patch | 518 bytes | minorOffense |
#16 | 1315366-incomplete-behavior-16.patch | 1.27 KB | minorOffense |
#12 | conditional_fields-undefined_function_fatal-1315366-12.patch | 633 bytes | AaronBauman |
Comments
Comment #1
Buckminster_Bond CreditAttribution: Buckminster_Bond commentedFurther investigation. Note that the error is on line 570 of a clean install (no patches)
I don't now think that this error has anything to do with field permissions (as I've removed that module.)
The error occurs when any condition is added into the user section. It is only anonymous users that are affected.
(example condition - field_logo is visible when field_add_contact_details has value "1".)
Rolling back to an earlier version of dev3 (10 August) fixes this issue.
However, the version on 10 August breaks my other conditional fields, as long text and term references weren't playing together nicely back then!
Any help appreciated!
Comment #2
Buckminster_Bond CreditAttribution: Buckminster_Bond commentedIt seems that this issue (and I can't change the title!) of anonymous users getting error messages was also in the D6 version.
There is a fix here for D6.
Can it be fixed for D7? My PHP skills are not up to it - I have tried!
Comment #3
apmsooner CreditAttribution: apmsooner commentedActually i do concur there is a conflict with field permissions module. With field permissions module enabled I get the following error when i try to create or edit dependencies:
EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7405 of /home/~/public_html/drupal7/includes/common.inc).
If i disable field permissions, the form opens and i can set dependencies and they appear to work as they should but I can't modify existing or add new dependencies while field permissions is enabled.
Comment #4
zhenjan CreditAttribution: zhenjan commentedany progress on it?
Comment #5
MostlyGhostly CreditAttribution: MostlyGhostly commentedApparently not... Pity really.
Comment #6
john duff CreditAttribution: john duff commentedIf I can help: the error appears only if I check "Reset the dependent to its default values if the dependency is not triggered." in Node Edit options.
Comment #7
peterpoe CreditAttribution: peterpoe commentedWe made many fixes and changes lately, I suspect this issue is fixed, but could someone please confirm?
Comment #8
digitopo CreditAttribution: digitopo commentedI can confirm that it's not fixed... using following version of conditional fields module:
and following version of field permissions:
Any thoughts?
Comment #9
qasimzee CreditAttribution: qasimzee commentedsubscribe
Comment #10
digitopo CreditAttribution: digitopo commentedStill no update on this?
Comment #11
ah0 CreditAttribution: ah0 commentedany update for this?
Issue still exists and it makes the module not usable.
Comment #12
AaronBaumansimple "function_exists" before calling a user function.
This does not address the root issue of *why* the behaviors array is malformed -- i didn't dig far enough to figure out the problem.
However, this fix should get in quickly, since this is rendering the module unusable.
Comment #13
AaronBaumanFWIW: in my case this issue appears when I set
#access = false
on two fields in a dependency pair.Comment #14
peterpoe CreditAttribution: peterpoe commentedOk, I committed the patch proposed in #12, but I was not able to reproduce the problem with Field Permissions. Anyway, checking if the callback actually exists seems reasonable. Thanks!
If anyone experiencing the problem could provide more information on the exact steps to reproduce it, I will reopen the issue and investigate it further.
Comment #14.0
peterpoe CreditAttribution: peterpoe commented(Addition...just found out that removing the above breaks quite a lot! Conditional fields elsewhere, available to anonymous user have stopped working...)
Comment #15
minorOffense CreditAttribution: minorOffense commentedI've managed to replicate the issue.
It happens when a field has a dependee which is supposed to reset the value if it is unchecked on submit. The way the logic is laid out, the clean up for the
CONDITIONAL_FIELDS_FIELD_EDIT_RESET_UNTRIGGERED
option is left stray in the$behaviors
array. Then the value of "3" is attempted to be used as a function (which causes the warning).See line 464
Just before the continue there should be another line
To remove that behavior as well. Otherwise the code down below near the end of the foreach, which is supposed to do the reset stuff, is never run (see line 576)
I'll provide a patch in my next comment.
Comment #16
minorOffense CreditAttribution: minorOffense commentedComment #17
minorOffense CreditAttribution: minorOffense commentedThis isn't a bug with other modules, this is an issue with any dependee field with #access set to false with the reset value behavior enabled.
Comment #18
andrewbelcher CreditAttribution: andrewbelcher commentedThis patch does the trick, though it looks like it's picked up some white space modifications?
Comment #19
minorOffense CreditAttribution: minorOffense commentedAh ok, well I'll have to reroll it.
No chance to just take the whitespace fixes :-D ?
Comment #20
minorOffense CreditAttribution: minorOffense commentedSee if just erasing those lines from the patch file works...
Comment #22
minorOffense CreditAttribution: minorOffense commentedLet's try that one more time...
Comment #23
andrewbelcher CreditAttribution: andrewbelcher commentedLooks good! This patch works perfectly for me!
Comment #25
peterpoe CreditAttribution: peterpoe commentedCommitted, thanks!