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.
I am getting these three notices in watchdog:
Notice: Undefined property: stdClass::$module in captcha_get_form_id_setting() (line 85 of /sites/all/modules/captcha/captcha.inc).
Notice: Undefined property: stdClass::$captcha_type in captcha_get_form_id_setting() (line 75 of /sites/all/modules/captcha/captcha.inc).
Notice: Undefined property: stdClass::$captcha_type in captcha_get_form_id_setting() (line 85 of /sites/all/modules/captcha/captcha.inc).
Patch incoming...
Comment | File | Size | Author |
---|---|---|---|
#18 | captcha-fixnotices-2522040-18.patch | 1.64 KB | wundo |
#10 | return_contents.png | 13.54 KB | Michelle |
Comments
Comment #1
MichelleComment #2
MichelleHere is the patch.
Comment #3
naveenvalechaThe patch is quick fix to the problem but it would be nice if you will share the whole usecase as well, So that we can get to know from where the captcha type is not set and instead fix there to find to root cause
Comment #4
MichelleMy assignment was to fix all the errors that turned up when the site was run on PHP 5.5 since Acquia is discontinuing 5.3 support. So all I know is these errors turned up when I spidered the site under PHP 5.5. I'm assuming it was always not set and PHP just didn't complain about it before. I don't know if I can get any time approved to dig into this error further but I can ask tomorrow.
Comment #5
naveenvalechaOk fine Thanks for the patch!
leaving the decisions for the module maintainers.
Comment #6
DamienMcKennaComment #7
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedMichelle, why isset() and not empty()? :)
Comment #8
MichelleThe original code was checking to see if it was null. From my understanding, the equivalent of == NULL would be !isset() rather than !empty() so that's what I went with. I don't know if it really matters in this case. I was just trying to avoid changing the intent and possibly introducing other problems with my fix.
PS: I did get permission to dig into the issue further so will be doing that.
Comment #9
MichelleI made some progress into figuring this out but haven't quite unravelled it. Putting what I have so far out here in case it rings a bell for someone.
So this problem only happens if cTools is installed but I'm not sure why. I was tracing through the ctools_export_load_object code but got lost in a loop. I know it starts out with both "captcha_type" and "module" from the query but that's getting messed up somewhere during the data manipulation. I still have 30 minute left to dig into this so will work on it a bit more in the morning.
Comment #10
MichelleI've been digging into this more but I just don't know enough of the big picture to see how this should be working. From what I can tell, what CTools returns is totally different from what you get if you don't have CTools and just use the query because it's not returning the data it is fetching from the table.
These are the lines that determine what is being returned:
That is setting $return to the what is in the attached screenshot, which isn't the data that the captcha_get_form_id_setting() function is expecting.
At this point, I don't know if the problem is 1) something wrong on this site 2) something that changed in ctools 3) captcha using ctools' function wrong 4) something else entirely. If anyone has a clue, that would be much appreciated. :)
At any rate, the patch on this issue does prevent the notices from trying to use the non-existent properties so that at least could go in.
Comment #11
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #12
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #13
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedUpdating patch to use empty and adding another similar situation as well
Comment #14
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #16
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #18
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #20
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #22
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #25
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commentedComment #26
wundo CreditAttribution: wundo at Chuva Inc. for Chuva Inc. commented