Jump to content

Why is this variable used if it isn't declared?


Davigetto

Recommended Posts

Hello,

 

I'm developing modules for an IMS (Moodle) and, taking a look on the code, I've found something like this:

 

<?php //$Id: restore_check.html,v 1.48.2.6 2008/05/02 04:07:30 dongsheng Exp $
    //This page receive all the restore_form data. Then, if existing course
    //has been selected, shows a list of courses to select one.
    //It cheks that the parammeter from restore_form are coherent.
    //It puts all the restore info in the session.
    //Finally, it calls restore_execute to do the hard work
    //Get objects from session
    if ($SESSION) {
        $info = $SESSION->info;
        $course_header = $SESSION->course_header;
        if (isset($SESSION->restore)) {
            $restore = $SESSION->restore;
        }
    }

...

 

$SESSION variable is being read, however, in that file SESSION variable is not assigned at any place, and no declaration before. What is the reason for that?

 

Greetings

 

PD: Maybe I've done a bad explanation of my problem. If anyone needs more info, I shall give him it.

Link to comment
Share on other sites

Maybe this file is included into some other script?

 

You're sure its $SESSION and not $_SESSION (which is default global variable)?

 

Do you refer this?

 

    //Call the form, depending the step we are

    if (!$launch) {
        include_once("restore_precheck.html");
    } else if ($launch == "form") {
        if (!empty($SESSION->restore->importing)) {
...

 

Over the include_once, $SESSION variable has a value, but is this value passed indirectly to restore_precheck.html? Does The code of restore_precheck.html represent that it is being located literally after "if (!$launch)" instruction?

 

PD: I'm a Java developer, not PHP, so seeing this kind of code makes me mad and strange...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.