#40615 [NEW]: session_start() kills link resource variable

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40615 [NEW]: session_start() kills link resource variable

    From: jan dot morten dot sorensen at organizer dot net
    Operating system: Win2K
    PHP version: 5.2.1
    PHP Bug Type: Unknown/Other Function
    Bug description: session_start() kills link resource variable

    Description:
    ------------
    I have version 5.1.2. THIS MIGHT HAVE BEEN FIXED IN 5.2.1!!!

    First use mysql_connect() on an included file and return the resource
    identifier and store this in a variable.
    Then call session_start()
    Now you have lost your resource identifier!
    Calling session_start() first fixes the problem.

    Reproduce code:
    ---------------
    file1.php
    function connect_to_db() {
    $link = mysql_connect($host, $user, $pass) or die(err_msg);
    mysql_select_db($db) or die(err_msg);
    return $link;
    }
    file2.php
    include 'file1.php';
    $link = connect_to_db();
    echo $link;
    session_start();
    echo $link;

    Expected result:
    ----------------
    link resource id# ?
    link resource id# ?

    replace ? with a number

    Actual result:
    --------------
    link resource id# ?
    0

    --
    Edit bug report at [url]http://bugs.php.net/?id=40615&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40615&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40615&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40615&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40615&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40615&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40615&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40615&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40615&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40615&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40615&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40615&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40615&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40615&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40615&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40615&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40615&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40615&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40615&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40615&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40615&r=mysqlcfg[/url]
    jan dot morten dot sorensen at organizer dot net Guest

  2. Similar Questions and Discussions

    1. Flash remoting kills IIS?
      Here's a weird one... I'm running CFMX 7, developer edition, on an XP Pro laptop. I'm learning Flash Remoting from the "Flash MX 2004 Pro for Server...
    2. Make a set variable a link
      I'm working on modifying an existing app, but I need to make the #session.SchoolName# below a link - I've tried a few different options, and can't...
    3. Storing link text to a Cookie or Session Variable
      Another one of those "It sounds easy enough to do, but...." I need to store the value/text displayed as a hyperlink to either a Cookie or Session...
    4. #17248 [Com]: # is not a valid MySQL-Link resource
      ID: 17248 Comment by: UglyEugen at yahoo dot com Reported By: bbs at c-se dot de Status: No Feedback Bug Type:...
    5. flash kills keyCommands
      I have a flash sprite on the stage, whenever it is present my on keyDown handler doesnt execute. I have tried other flash sprites in its place and...
  3. #2

    Default #40615 [Opn->Bgs]: session_start() kills link resource variable

    ID: 40615
    Updated by: [email]johannes@php.net[/email]
    Reported By: jan dot morten dot sorensen at organizer dot net
    -Status: Open
    +Status: Bogus
    Bug Type: Unknown/Other Function
    Operating System: Win2K
    PHP Version: 5.2.1
    New Comment:

    I guess you have register_globals enabled and a session variable
    overwriting your local variable. Except for that please report only
    bugs related to the latest version of PHP


    Previous Comments:
    ------------------------------------------------------------------------

    [2007-02-23 23:08:02] jan dot morten dot sorensen at organizer dot net

    Description:
    ------------
    I have version 5.1.2. THIS MIGHT HAVE BEEN FIXED IN 5.2.1!!!

    First use mysql_connect() on an included file and return the resource
    identifier and store this in a variable.
    Then call session_start()
    Now you have lost your resource identifier!
    Calling session_start() first fixes the problem.

    Reproduce code:
    ---------------
    file1.php
    function connect_to_db() {
    $link = mysql_connect($host, $user, $pass) or die(err_msg);
    mysql_select_db($db) or die(err_msg);
    return $link;
    }
    file2.php
    include 'file1.php';
    $link = connect_to_db();
    echo $link;
    session_start();
    echo $link;

    Expected result:
    ----------------
    link resource id# ?
    link resource id# ?

    replace ? with a number

    Actual result:
    --------------
    link resource id# ?
    0


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40615&edit=1[/url]
    johannes@php.net Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139