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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jay.lee.bio’s picture

Title: Upgrade Errors » Upgrade Error Messages (7.x-1.0-rc2 -> 7.x-1.0-rc3)
Issue summary: View changes
jaydee1818’s picture

I did not get the same error but when I updated using Drush I got a couple of warnings and then multiple success messages:

The following updates are pending:

faq module : 
  7002 -   Convert old-style detailed questions to new fields. 

Do you wish to run all pending updates? (y/n): y
strpos() expects parameter 1 to be string, array given field_default_token.module:23                                                                           [warning]
strpos() expects parameter 1 to be string, array given field_default_token.module:23                                                                           [warning]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]
Performed update: faq_update_7002                                                                                                                              [ok]

Finished performing updates.

I also found this entry repeatedly in my Watchdog log after the update when visiting my-site.com/faq-page:

Warning: Invalid argument supplied for foreach() in tablefield_field_formatter_view() (line 345 of /../sites/all/modules/tablefield/tablefield.module).

AlexanderPop’s picture

I 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).

podarok’s picture

Added this issue to known issues to release notes https://www.drupal.org/node/2371961

Eketol’s picture

I have exactly the same issue than AlexanderPop (#3).

Ok, to solve it I followed these steps:

  • Make backup of the database.
  • In the table 'field_config', delete the record with field_name: 'field_detailed_question'.
  • Delete the table 'field_data_field_detailed_question'.
  • Delete the table 'field_revision_field_detailed_question'.

Then I ran update.php without issues this time. I hope it helps somebody.

jwilson3’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.09 KB

For 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.

hwasem’s picture

Thank 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.

  • podarok committed fdd0635 on 7.x-1.x authored by jwilson3
    Issue #2372339 by jwilson3, hwasem: Upgrade Error Messages (7.x-1.0-rc2...
podarok’s picture

Status: Needs review » Fixed

thanks, commited

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

loopy1492’s picture

I 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.

The following updates returned messages

faq module

Update #7002
Failed: FieldException: Attempt to create field name <em class="placeholder">field_detailed_question</em> which already exists and is active. in field_create_field() (line 85 of /var/www/vhosts/dev.MYSITE.gov/modules/field/field.crud.inc).

Should I go into the database and manually make the changes? This is causing errors all over my sites which use this module.

Status: Closed (fixed) » Needs review
zietbukuel’s picture

Same for me, it broke my site.

StijnBousard’s picture

Thanks, Eketol, that did the trick!

bertvanhees’s picture

#5 +1

andrey.troeglazov’s picture

Status: Needs review » Fixed

Moving to correct status.

andrey.troeglazov’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.