Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On my site I was trying to debug some errors I was getting and noticed the webform block was throwing some errors too. I'm not really a php coder though so, not sure what to do. These are the messages I am getting.
Notice: Undefined offset: 2 in /var/www/vhosts/mysite.com/httpdocs/sites/all/modules/webformblock/webformblock.module on line 15
and
Notice: Trying to get property of non-object in /var/www/vhosts/mysite.com/httpdocs/sites/all/modules/webformblock/webformblock.module on line 27
Are any of these big deals? I can't figure out what it means by undefined offset.
Becky
Comment | File | Size | Author |
---|---|---|---|
#9 | webformblock-phperror-847048-9.patch | 1.44 KB | fuzzy76 |
#6 | webformblock.module-form_alter-847048.patch | 1.48 KB | azovsky |
#2 | webformblock-847048.patch | 2.94 KB | mikeytown2 |
Comments
Comment #1
lmeister CreditAttribution: lmeister commentedThey are not really errors but a php notice usually suggests the code could be improved. I also got annoyed with these notices appearing in my logs so slightly changed the code.
Here is the altered function for 6.x-1.1 if you compare to the original you will see the slight differences. Nothing major just checking array keys actually exist before trying to use them. Hope that helps.
Comment #2
mikeytown2 CreditAttribution: mikeytown2 commentedalso has a small whitespace fix
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedComment #4
noslokire CreditAttribution: noslokire commentedLooks good to me
Comment #5
azovsky CreditAttribution: azovsky commentedMy solution of the problem for Webform Block 6.x-1.2:
Comment #6
azovsky CreditAttribution: azovsky commentedSorry, the file was lost. Here it is:
Comment #7
MichelleThis worked for me to get rid of the errors.
Comment #8
fuzzy76 CreditAttribution: fuzzy76 commentedRerolled against latest stable for makefile usage.
Comment #9
fuzzy76 CreditAttribution: fuzzy76 commentedThat patch had 2 whitespace errors and still produced PHP warnings. Here's a new one (still rolled against 6.x-1.2 stable - does not apply to head).