We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Problem with SESS and LANG

Development and Programming

biberltd's avatar
biberltd
54 posts
16 years ago
biberltd's avatar biberltd

Hi everyone,

I am trying to develop a new extension (just for fun and just to get more knowledge about EE). However in my extension $LANG and $SESS objects are never loaded. When I var_dump, I see that they are NULL. Other objects are working fine.

I have an empty function in my extension that starts with the below lines

function empty_function(){
      global $SESS, $IN, $DB, $LANG;
      var_dump($SESS);
      var_dump($LANG);
      var_dump($IN);
      var_dump($DB);
}

the output for sess and lang are null. Am i missing something? If you have any tip, I’ll be glad to hear them. Thanks.

Can Berkol

       
biberltd's avatar
biberltd
54 posts
16 years ago
biberltd's avatar biberltd

it seems like this is an issue based on the false usage of hooks. now i’m checking the issue. as soon as i figure out what stupid mistake I am doing. i’ll let you guys also know.

       
biberltd's avatar
biberltd
54 posts
16 years ago
biberltd's avatar biberltd

First problem is solved. I was using sessions_end hook which is used with a parameter. (documentation says $this, of course if you pass parameter with the name $this under PHP5 environment then you will get an error). Anyhow, I was for some reason ignoring that sessions_start required a param. When I modified the function to this

function empty_function($SESS){
      global $IN, $DB, $LANG;
      var_dump($SESS);
      var_dump($LANG);
      var_dump($IN);
      var_dump($DB);
}

I was successfull able to access to content of $SESS.

Now, I have to figure out what’s wrong with $LANG. Maybe $LANG is not supported with extensions, huh? What do you say? 😊 hmmm….

       
biberltd's avatar
biberltd
54 posts
16 years ago
biberltd's avatar biberltd

It seems like each hook supports different globals (classes). As far as I understood sessions_start hook does not support $LANG.

May be I could’nt find that info in documentation but if it is not there I think this is an important piece of knowledge for developers and it should be included.

So basically, problem is solved. Lessons learned are:

1- Do not ignore hook parametes. 2- Not all the hooks support all the core classes.

If I’m wrong feel free to correct me.

Thanks, Can Berkol

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.