The latest 1.x dev update produces the following error message whenever a FAQ page is accessed:

php,Notice: Undefined index: safe_value in theme_field_detailed_question() (line 1640 of /home/ww7ba/all-things-android.com/sites/all/modules/faq/faq.module).,notice,http://www.all-things-android.com/content/phone-codes-samsung-galaxy-s-iii,94.11.34.232,17/Jan 09:08

I never received this error in the past.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

billsdesk’s picture

Today, I noticed what could be a clue to the problem. Detailed Question is disabled in the form and display. Yet, when I edit a FAQ the Description text box briefly appears, and then is overlayed by the Detail Question text box.

I do use the Display Suite, but it never created a problem in the past. Every time a visitor accesses a FAQ, I get the PHP warning described in the previous message.

AlfTheCat’s picture

Having the exact sameissue. Did you ever solve this problem?

sah62’s picture

Version: 7.x-1.x-dev » 7.x-1.0-rc3

I'm also seeing this notice in 7.x-1.0-rc3.

sah62’s picture

I think I've figured out how to reproduce this and can confirm @billsdesk's observation.

I found that the PHP notice was appearing when I had "Allow long question text to be configured" enabled and I added a "Detailed question" to one of my FAQ nodes. When I do that, and then view my FAQ, the notice appears. If I remove the detailed question, disable "Allow long question text to be configured", and then view the FAQ there are no notices produced.

The safe_value values are supposed to be set during the execution of function faq_update_7002 in faq.install. Could it be that this update wasn't performed when I installed and enabled 7.x-1.0-rc3 using drush? "drush pm-update faq" says that everything is up to date.

berenddeboer’s picture

I'm seeing this issue as well, and on the faq-page page I only see the short questions, not the detailed questions as I have configured.

DrCord’s picture

sah62's: #4 - report and fix is correct.

r2coder’s picture

I experienced the same issue and was able to resolve by adding a 'isset' before the offending line. So it looks like this:

 // Render the items.
  /***
  * TO FIX:Notice: Undefined index: safe_value in theme_field_detailed_question() (line 1793 of /var$
  **/
  if(isset($variables['safe_value'])){
  $output .= '<div class="faq-detailed-question">' . $variables['safe_value'] . '</div>';
   }

Looks like this was forgotten as the rest of code includes this protection.
Drupal: 7.34
FAQ: 7.x-1.0-rc3

loopy1492’s picture

Oh wow. Yeah. It also seemed to actually remove the data I'd inputted into the field as well for some of my FAQs! Not just disappearing from the list view but actually clearing out the content I'd put in. I had to go through and put all the detailed questions from the original content PDF I'd received from the client and put it in the short question field in order for them to show up properly. That was a lot of work.

Hope there's an update soon.

sah62’s picture

I'm not seeing this issue in 7.x-1.0. Is anyone still seeing it after upgrading?

DrCord’s picture

I still get the warning after update to 7.x-1.0

annya’s picture

Version: 7.x-1.0-rc3 » 7.x-1.x-dev
Status: Active » Needs review
FileSize
1.96 KB

The problem is following:
1. FAQ uses index 'safe_value' to show detailed question text.
2. In function text_field_load you can see that 'safe_value' exists only if

Only process items with a cacheable format, the rest will be handled by formatters if needed.

3. If you use filter in you text format that disables caching(for example you install module Token Filter) 'safe_value' won't be created.
4. Solution: use field_view_value instead of 'safe_value'. See attached patch

jerry’s picture

Patch in #11 also works for me with 7.x-1.0.

dadderley’s picture

Yup, me too.
Patch in #11 also works for me with 7.x-1.0.

sender’s picture

Running into the same issue. Can this be merged?

richH’s picture

Also +1 for merging this.

annya’s picture

Hi, guys! I'm happy that patch in #11 helps you. But please read this one https://www.drupal.org/issue-queue/status
In general patch has to be in RTBC-status before committing. So if someone can do it, please review patch and if everything is ok, change status to RTBC.

sender’s picture

Status: Needs review » Reviewed & tested by the community

@annya I've applied the patch and the problem seems resolved (no more error messages). No regressions so far. So, at least 4 persons benefited from this patch, so me thinks that 'reviewed & tested by the community' is appropriate!

pietrocap’s picture

Patch in #11 also works for me with 7.x-1.0.

Jaypan’s picture

The patch in #11 also works for me for 7.x-1.1.

artem0793’s picture

FileSize
1.3 KB

My patch resolves only notice needs to review all functions. In the future, I will highlight the time and do a more thorough research. On this time maybe this correct solution

pazhyn’s picture

Status: Reviewed & tested by the community » Needs review
bobburns’s picture

Looks like I will have to downgrade to 7x-1.1 - I have the 2.0 alpha and it ONLY works when module is disabled - nothing when module is enabled and the permissions are all checked to "view". The blocks still do not work at all

pietrocap’s picture

Hi,
same problem in 7.x-2.x.
I was able to get rid of the warning following instructions as in #7

gg24’s picture

Steps followed to test this bug:

1- Created four sample FAQ contents.
2- Accessed '/faq-page'.
3- Check recent logs.

Found no errors. Not able to reproduce it anymore.
Drupal 7.54, FAQ '7.x-1.x latest version'

Maybe this got resolved in some parallel issue.

Thanks!

andrey.troeglazov’s picture

Issue tags: +FAQ Release 7.x-1.2

andrey.troeglazov’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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