SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast cliffgs's Avatar
    Join Date
    Aug 2003
    Location
    West Coast, New Zealand
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with: PHP Warning: Unknown: Your script possibly relies on a session side-effec

    Hi

    I have followed (except with the change of details) a script fragment from PHP MySQL 4th Edition. It is shown below:
    Code:
    <?php
    $thispage = "contact";
    session_start();
    $cart = '';
    $notice = '';
    $order = NULL;
    if (isset($_SESSION['cart'])) {
        $cart = $_SESSION['cart'];
        session_destroy();
        $notice = "<b>Most parts have a left and right side. If you only intend to order one or the other, please delete the side not required. Also, <span style='color:red;'>please change the Enquiry Type to either &ldquo;Parts Order&rdquo; or &ldquo;Parts Enquiry&rdquo;.</span> Remember to fill in your details at the top of the form. Thank you.</b>";
        $order = "Parts Order";
        $enquiry = "Parts Enquiry";
    }
    I am getting the error message:

    [31-May-2012 15:23:38] PHP Warning: 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_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively in Unknown on line 0

    Apart from no knowing how to fix this, I am also not sure where line 0 would be. Is it something I should worry about, or can I just let it ride. I know it is possible to live with PHP Notices, but am also not sure about Warnings.

    I have checked in the manual, and it seems that register_globals is a bad thing. But I haven't a clue how to avoid getting this warning.

    Thanks

  2. #2
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Maui, HI
    Posts
    211
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    I read somewhere that someone had that issue when they used a global variable name for a session variable. Try renaming either $_SESSION['cart'] or $cart.

  3. #3
    SitePoint Enthusiast cliffgs's Avatar
    Join Date
    Aug 2003
    Location
    West Coast, New Zealand
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, thank you very much! Not only did that fix the problem, but I also now understand the meaning of the Warning message. Another little piece of the jigsaw in place.

  4. #4
    SitePoint Addict kduv's Avatar
    Join Date
    May 2012
    Location
    Maui, HI
    Posts
    211
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    NP


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •