Error:Unknown: Your script possibly relies on a session side-effect which existed unt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    Error:Unknown: Your script possibly relies on a session side-effect which existed unt

    I developed web application using php. But some pages display a error message.

    Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_global s is enabled. You can disable this functionality and this warning by setting session.bug_com pat_42 or session.bug_com pat_warn to off, respectively. in Unknown on line 0

    Could some one help me? Still I couldn't find what is the wrong with my code.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, ghjk.

    Check out the comments on the Sessions page of the PHP Manual (http://php.net/manual/en/ref.session.php#55239).

    Comment

    • samatair
      New Member
      • Nov 2007
      • 61

      #3
      The error only appears when you try to update a session variable using 'NULL' value
      and try to assign a value to the same named variable in the global scope.
      like below. I found this in another site. It worked for me.
      [code=PHP]
      <?php
      session_start() ;
      $_SESSION['sample'] = NULL;
      $sample ="simple";
      ?>
      [/code]
      Last edited by Atli; Mar 3 '09, 05:58 PM. Reason: Fixed the [code] tags.

      Comment

      • ghjk
        Contributor
        • Jan 2008
        • 250

        #4
        Originally posted by samatair
        The error only appears when you try to update a session variable using 'NULL' value
        and try to assign a value to the same named variable in the global scope.
        like below. I found this in another site. It worked for me.
        [PHP]
        <?php
        session_start() ;
        $_SESSION['sample'] = NULL;
        $sample ="simple";
        ?>
        [/PHP]

        yes. That's the error. Thanx a lot .

        Comment

        • OfficeTech
          New Member
          • Mar 2009
          • 1

          #5
          We had just come across this problem with a particular website we are developing and believe that we know of the main cause as we have never received this error before and try to test most limits on development.

          The Problem Code:
          Code:
          <?php
            $orderItem = $_SESSION["orderItem"];
            $orderPrice = $_SESSION["orderPrice"];
          ?>
          The Fixed Code:
          Code:
          <?php
            $SorderItem = $_SESSION["orderItem"];
            $SorderPrice = $_SESSION["orderPrice"];
          ?>
          Basiclly we have until now used the exact same name for a session variable in this way, But seems this was the cause of the error for us.

          Hope this helps a few people around?
          <link removed - no unnecessary links please>

          Comment

          • cell1
            New Member
            • Dec 2009
            • 2

            #6
            I am getting this error in my Joomla based web site, skicow.com. I can't see any direct assignments to/from $_SESSION using the same key as the assigned variable, however, there are assignments such as the following in the Joomla code:

            $session_id = mosGetParam( $_SESSION, 'session_id', '' );

            Can anyone tell me if this will cause the errors?

            Comment

            • Markus
              Recognized Expert Expert
              • Jun 2007
              • 6092

              #7
              Originally posted by cell1
              I am getting this error in my Joomla based web site, skicow.com. I can't see any direct assignments to/from $_SESSION using the same key as the assigned variable, however, there are assignments such as the following in the Joomla code:

              $session_id = mosGetParam( $_SESSION, 'session_id', '' );

              Can anyone tell me if this will cause the errors?
              Based on the previous replies to this thread, I guess it will cause the error. I suspect the code you posted would expand to something like
              Code:
              $session_id = $_SESSION['session_id'];
              which seems to be problematic.

              I think if you turn register_global s off, you will circumvent this issue.

              Comment

              • cell1
                New Member
                • Dec 2009
                • 2

                #8
                Well the code in the mosGetParam function assigning the variable is:

                $return = $arr[$name];

                where $arr is a parameter taking $_SESSION (or anything else) and return is passed back as the function's result.

                Obviously the effect is the same as $session_id = $_SESSION['session_id'], however, I was wondering if the intermediate variables would fool the PHP runtime enough to prevent the warnings.

                Comment

                Working...