Persons module + $sessions code

1 reply [Last post]
john.lafosse
Offline
Last seen: 9 years 26 weeks ago
Joined: 2012-10-31

On Line 240

 drupal_set_message(t('You recently searched for: ') . $_SESSION['recent_search']);

Undefined indexes are appearing in Drupal 7.17:

Notice: Undefined index: recent_search in persons_init() (line 240 of /var/www/drupal7/sites/all/modules/persons/persons.module).
Notice: Undefined index: store_search_history in persons_save_search_submit() (line 55 of /var/www/drupal7/sites/all/modules/persons/persons.module).
Notice: Undefined index: recent_search in persons_init() (line 240 of /var/www/drupal7/sites/all/modules/persons/persons.module).

Line 55 is the following:

 if ($account->data['store_search_history'] != 1) {
    return;
  }

After adding to store history the line 55 error disappeared.

These are the errors the coder module returned:
"
Line 191: Potential problem: drupal_set_message() only accepts filtered text, be sure to use check_plain(), filter_xss() or similar to ensure your $variable is fully sanitized.

drupal_set_message($message);

severity: criticalLine 240: Potential problem: drupal_set_message() only accepts filtered text, be sure all !placeholders for $variables in t() are fully sanitized using check_plain(), filter_xss() or similar. (Drupal Docs)

drupal_set_message(t('You recently searched for: ') . $_SESSION['recent_search']);

severity: normalLine 240: The $string argument to t() should not begin or end with a space. (Drupal Docs)

drupal_set_message(t('You recently searched for: ') . $_SESSION['recent_search']); "

The coder upgrade module is unchecked. I reviewed drupal docs and it is over my head.
P.S. I have not reviewed much of the PHP chapters. Will do so in the coming weeks.

john.lafosse
Offline
Last seen: 9 years 26 weeks ago
Joined: 2012-10-31
side note + Webmin

As a side note:
I'm using a Turnkey Linux virtual box. The Webmin says something about XSS security update to prevent vulnerabilities. Don't think it should case a problem with 7.17. I will also read the change history in
7.17. Maybe, I'm missing a new procedure for drupal_set_message.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.