I'm getting this error upon enabling the module. It also essentially breaks fields and adding content until disabled and uninstalled.
"Notice: Undefined offset: 1 in rules_linkevent_get_links() (line 83 of /home2/easteru0/public_html/sites/all/modules/rules_linkevent/rules_linkevent.module).
Notice: Undefined offset: 2 in rules_linkevent_get_links() (line 84 of /home2/easteru0/public_html/sites/all/modules/rules_linkevent/rules_linkevent.module).
Notice: Undefined offset: 1 in rules_linkevent_get_links() (line 83 of /home2/easteru0/public_html/sites/all/modules/rules_linkevent/rules_linkevent.module).
Notice: Undefined offset: 2 in rules_linkevent_get_links() (line 84 of /home2/easteru0/public_html/sites/all/modules/rules_linkevent/rules_linkevent.module)."
I checked there and those lines contain this portion.
function rules_linkevent_get_links() {
$rules_string = variable_get('rules_linkevent', '');
$rules_list = explode("\n", $rules_string);
$rules = array();
foreach ($rules_list as $rule) {
$rule_parts = explode("|", $rule);
$link = new stdClass;
$link->name = $rule_parts[0];
$link->path = $rule_parts[1];
$link->label = $rule_parts[2];
$rules[] = $link;
}
Specifically lines 83 and 84 are in bold.
Anyone have an idea what might be up? Thanks.
Ryan
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | rules_linkevent_undefined_offset-1327396-20.patch | 987 bytes | deggertsen |
| #18 | rules_linkevent.zip | 3.62 KB | silkogelman |
| #9 | rules_linkevent-undefined_offset-1327396-6.patch | 596 bytes | coleman.sean.c |
| #2 | rules_linkevent.1327396.patch | 695 bytes | jpontani |
Comments
Comment #1
aidanlis commentedHi Ryan,
Oh you're getting this when the module is enabled? The easiest way to fix it is to simply add a rule in, then the error will go away. I'll fix it properly in the next release.
Comment #2
jpontani commentedAttached is a patch that fixes this issue. All it does it make sure there is more than 1 item in the exploded array. Temporary fix as aidanlis is moving away from variables table eventually.
Comment #3
ryan.ryan commented@jpontani
Thank you so much for your work on this fix, you were a huge help to me!
Comment #4
jpontani commented@aidanlis The issue is that the function rules_linkevent_get_links() is causing the error, but it is also called in hook_menu so the menu router items never get created since it throws an error. Thus, you cannot register a path as the menu router never knows that admin/config/workflow/rules/links should use your defined form to create a link.
Comment #5
aidanlis commentedOhh nice find, thanks jpontani. Not sure how that escaped my pre-release testing.
Comment #6
jckonczal commentedThe root of the problem is that explode, strangely, returns a one-element array, containing the original string, when the delimiter is not found and the limit is not negative. Then the foreach loop is run once, and the explode there does the same thing before lines 83 and 84 try to access parts 1 and 2. I fixed it myself by adding an if statement to allow the foreach to run only when $rules_string is not empty, right before I thought of looking at these issues.
Comment #7
ryan.ryan commentedSo is there any works into getting this taken care of? I'm still getting the error.
Comment #8
dave kopecekThis is still an issue with 7.x-1.0-alpha1
Comment #9
coleman.sean.c commentedHere's a patch that uses the solution described in #6. Not very pretty, but seems to work.
Comment #10
socialnicheguru commentedpatch works for me
Comment #11
michaeldhart commentedpatch also works for me
Comment #12
rerooting commentedworks great for me. would highly suggest committing this patch or an improved version if possible!
Comment #13
stefansan commentedhi,
i have the same problem.
where must i put the patch to?
thanks for answers.
stefan
Comment #14
stefansan commentedok, i got it. it works.
thanks for the patch...
Comment #15
SolomonGifford commentedThis patch doesn't work unless applied after going to admin/config/workflow/rules/links and setting some rules.
Comment #16
Funksmaname commentedpatch #9 seemed to do the trick for me straight after initial install.
Now to work out how to create link events! :P
Comment #17
silkogelman commentedThis issue prevents being able to use the module.
Comment #18
silkogelman commentedApplied Patch from #2 and #6 and tested with the configuration suggested in http://drupal.org/node/1491940#comment-6174798
It seems to work perfectly, so setting this to RTBC.
Thanks for the patches guys!
Attached is the patched version of the module, so people can test it without having to apply both patches.
P.S.
In my case having rules_link enabled prevented this rules_linkevent configuration from working properly.
However, that seems like a matter for another issue.
Comment #19
deggertsen commentedCould somebody roll this into one patch and then I will try to get it committed?
Thanks.
Comment #20
deggertsen commentedCommitted. Thanks to @jpontani, @coleman.sean.c, and all who contributed here.