Hi,
I am working on porting a module to d7.
I am getting an error "Notice: Undefined index: VARIABLE NAME in.........
I have searched the internet and tried using drupal_set_session but I am still getting the same error.
I am using D7.8
....Correction
when I use drupal_set_session I get this error (Fatal error: Call to undefined function drupal_set_session() in)
does it work in D7?
On 23/09/2011, Mutuku Ndeti jnmutuku@gmail.com wrote:
Hi,
I am working on porting a module to d7.
I am getting an error "Notice: Undefined index: VARIABLE NAME in.........
I have searched the internet and tried using drupal_set_session but I am still getting the same error.
I am using D7.8
-- Tel:254- 722-490994 www.agile.co.ke | www.jipambe.com
The Drupal API docs are here http://api.drupal.org/api/drupal.You can find out whether or not it's available in D7, and how to use it. Most changes are listed here http://drupal.org/update/modules/6/7
Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: Mutuku Ndeti
....Correction
when I use drupal_set_session I get this error (Fatal error: Call to undefined function drupal_set_session() in)
does it work in D7?
The error is most likely cuased by accessing the $_SESSION variable, not setting it. Look for places in your code where test for something like:
$_SESSION['foo']
In if the index 'foo' for the session variable has not been set then you will get this error, because drupal 7 reports notices as well as warnings.
Depending on the situation you may want to recode like this:
if (isset($_SESSION['foo'])
Or like this:
@$SESSION['foo']
The @ operator will suppress errors and warnings in the site for that atomic command. The isset will test whether the index is set without throwing the notice to begin with.
-----Original Message----- From: support-bounces@drupal.org [mailto:support-bounces@drupal.org] On Behalf Of Mutuku Ndeti Sent: Friday, September 23, 2011 2:44 AM To: support Subject: [support] $_SESSION Variables in drupal 7
Hi,
I am working on porting a module to d7.
I am getting an error "Notice: Undefined index: VARIABLE NAME in.........
I have searched the internet and tried using drupal_set_session but I am still getting the same error.
I am using D7.8