Closed (fixed)
Project:
Webform
Version:
7.x-3.9
Component:
Code
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2011 at 10:07 UTC
Updated:
26 May 2011 at 01:51 UTC
Jump to comment: Most recent file
Hi,
I've got this Notice with Webform 7.x-3.9 on a fresh D7 install :
Notice : Undefined index: p2 in webform_component_list() (line 880 in /drupal/sites/all/modules/webform/includes/webform.components.inc).
The thing is I cannot tell exactly how it occurred. I know that I had it while creating a new Select options row as well as cloning one...but I also had several Selects options rows without any Notice message !
Weird isn't it ?
BTW, I saw @Network reporting this issue in #992220: Notice: Undefined variable: cid in webform_component_list() when trying to add a field. Here's the dedicated issue.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | webform_group_notice.patch | 1004 bytes | quicksketch |
Comments
Comment #1
lednew commentedI have experienced the same problem. To reproduce, create a webform with at least two pagebreaks (3 pages) and one or more components of type textfield or select on each page. The error will occur going to/coming from the edit screen of components placed on page 3 and beyond.
webform_component_list() is used in this moment to populate the "component" pull-down under "Conditional Rules" at the bottom of the edit page. The function is fed a list of components up until the last pagebreak, thus no errors until page 3. (The function is fine when it gets only page 1 components.)
webform_component_list() populates an array named $options, which contains cid(component id)=>label pairs for page 1 components, but also an array named "p2" of page 2 components, an array named "p3"... Line 880 takes the last of these and assumes the key portion is the cid of a web component. In some cases, however, it is "p2" or "p3". Since there is no component with an id of "p2", a notice is returned.
Comment #2
mikebell_ commentedCan recreate using the following:
-Clean minimal Drupal 7 instal
-Enable Webform
-Create new webform
-Create textfield
-Create pagebreak
-Create select
-Create pagebreak
Error then appears.
Comment #3
quicksketchThanks guys. I couldn't make any sense of that segment of code and (it turns out) it wasn't doing anything anyway because it was supposed to be doing a comparison between $cid and $previous_cid, but $previous_cid was never getting incremented (it was always 0). Considering I couldn't figure out even why I put this code in here and it's not doing anything now, I've just removed the whole offending code block.