Problem statement
The following error messages are shown when upgrading from 7.x-1.0-rc2 to 7.x-1.0-rc3:
1) Notice: Undefined property: stdClass::$detailed_question in faq_update_7002() (line 356 of /home/mysite/public_html/sites/all/modules/faq/faq.install).
2) Notice: Undefined offset: 10 in faq_update_7002() (line 350 of /home/mysite/public_html/sites/all/modules/faq/faq.install).
FYI, I got one error message for each FAQ for the first one and just one in total for the second one. Did anyone else get these messages?
Proposed Solution
For error message 1 -- The problem appears to be that $node->detailed_question does not exist for some faq nodes after a node_load(). My solution was to just wrap this in an isset()
with a ternary operator.
For OP error message 2 -- The problem is that you cannot call filter_formats() inside array_keys(), and you cannot call array_keys() inside reset, you must use intermediary variables.
Comment | File | Size | Author |
---|---|---|---|
#6 | faq-faq_update_7002-php-warnings-and-errors-2372339.patch | 1.09 KB | jwilson3 |
Comments
Comment #1
jay.lee.bio CreditAttribution: jay.lee.bio commentedComment #2
jaydee1818 CreditAttribution: jaydee1818 commentedI did not get the same error but when I updated using Drush I got a couple of warnings and then multiple success messages:
I also found this entry repeatedly in my Watchdog log after the update when visiting my-site.com/faq-page:
Comment #3
AlexanderPop CreditAttribution: AlexanderPop commentedI have
faq module
Update #7002
Failed: FieldException: Attempt to create field name field_detailed_question which already exists and is active. in field_create_field() (line 85 of /home/drupal7b/public_html/modules/field/field.crud.inc).
Comment #4
podarokAdded this issue to known issues to release notes https://www.drupal.org/node/2371961
Comment #5
Eketol CreditAttribution: Eketol commentedI have exactly the same issue than AlexanderPop (#3).
Ok, to solve it I followed these steps:
Then I ran update.php without issues this time. I hope it helps somebody.
Comment #6
jwilson3For OP error message 1 -- The problem appears to be that $node->detailed_question does not exist for some faq nodes after a node_load(). My solution was to just wrap this in an
isset()
with a ternary operator.For OP error message 2 -- The problem is that you cannot call filter_formats() inside array_keys(), and you cannot call array_keys() inside reset, you must use intermediary variables.
For comments #3 and #5, it is possible that you're hitting those issues because you had to run the updates twice? Anyway, those issues seem totally unrelated to the issues from the OP.
Comment #7
hwasem CreditAttribution: hwasem commentedThank you for this patch. I was able to update my dev site with the FAQ module and didn't receive errors like I did on my last attempt.
Comment #9
podarokthanks, commited
Comment #11
loopy1492 CreditAttribution: loopy1492 commentedI can't imagine why, but even after the commit, this isn't working for me. I have checked the faq.install and the patch has been applied. I have cleared caches, run update.php, checked the uploaded version of the file on the server... everything.
Should I go into the database and manually make the changes? This is causing errors all over my sites which use this module.
Comment #13
zietbukuel CreditAttribution: zietbukuel commentedSame for me, it broke my site.
Comment #15
StijnBousard CreditAttribution: StijnBousard commentedThanks, Eketol, that did the trick!
Comment #16
bertvanhees CreditAttribution: bertvanhees commented#5 +1
Comment #17
andrey.troeglazov CreditAttribution: andrey.troeglazov at DrupalJedi commentedMoving to correct status.
Comment #18
andrey.troeglazov CreditAttribution: andrey.troeglazov at DrupalJedi commented