#39352 [NEW]: oci_close fails with global keyword

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

  1. #1

    Default #39352 [NEW]: oci_close fails with global keyword

    From: david at acz dot org
    Operating system: SuSE Linux 9.3
    PHP version: 5.2.0
    PHP Bug Type: OCI8 related
    Bug description: oci_close fails with global keyword

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via the
    "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL


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

  2. Similar Questions and Discussions

    1. #40313 [NEW]: oci_close() has no effect when in a transaction
      From: christopher dot jones at oracle dot com Operating system: n/a PHP version: 5.2.1RC4 PHP Bug Type: OCI8 related Bug...
    2. #39569 [Opn->Fbk]: OCI_Close doesn't close the connection.
      ID: 39569 Updated by: tony2001@php.net Reported By: mc_hades at yahoo dot com -Status: Open +Status: ...
    3. #39569 [NEW]: OCI_Close doesn't close the connection.
      From: mc_hades at yahoo dot com Operating system: HP-UX PHP version: 5.2.0 PHP Bug Type: OCI8 related Bug description: ...
    4. #25652 [Opn->Ver]: Calling Global functions dynamically fails from Class scope
      ID: 25652 Updated by: sniper@php.net Reported By: john@php.net -Status: Open +Status: Verified Bug...
    5. #25652 [Com]: Calling Global functions dynamically fails from Class scope
      ID: 25652 Comment by: peter dot prochaska at datev dot de Reported By: john@php.net Status: Open Bug Type: ...
  3. #2

    Default #39352 [Opn->Asn]: oci_close fails with global keyword

    ID: 39352
    Updated by: [email]iliaa@php.net[/email]
    Reported By: david at acz dot org
    -Status: Open
    +Status: Assigned
    Bug Type: OCI8 related
    Operating System: SuSE Linux 9.3
    PHP Version: 5.2.0
    -Assigned To:
    +Assigned To: tony2001


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

    [2006-11-02 22:54:38] david at acz dot org

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via
    the "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null
    given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL



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


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

  4. #3

    Default #39352 [Com]: oci_close fails with global keyword

    ID: 39352
    Comment by: anon at anon dot com
    Reported By: david at acz dot org
    Status: Assigned
    Bug Type: OCI8 related
    Operating System: SuSE Linux 9.3
    PHP Version: 5.2.0
    Assigned To: tony2001
    New Comment:

    reproduced on Windows 2003 server, using Nov 2 release of 5.2.0


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

    [2006-11-02 22:54:38] david at acz dot org

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via
    the "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null
    given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39352&edit=1[/url]
    anon at anon dot com Guest

  5. #4

    Default #39352 [Asn->Bgs]: oci_close fails with global keyword

    ID: 39352
    Updated by: [email]tony2001@php.net[/email]
    Reported By: david at acz dot org
    -Status: Assigned
    +Status: Bogus
    Bug Type: OCI8 related
    Operating System: SuSE Linux 9.3
    PHP Version: 5.2.0
    Assigned To: tony2001
    New Comment:

    Actually this has nothing to do with OCI8, as this is the way PHP
    handles resources.
    You can do the same trick with MySQL and it won't actually close the
    connection when using global variable, but it will work with $GLOBALS.



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

    [2006-11-06 08:50:31] anon at anon dot com

    reproduced on Windows 2003 server, using Nov 2 release of 5.2.0

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

    [2006-11-02 22:54:38] david at acz dot org

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via
    the "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null
    given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL



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


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

  6. #5

    Default #39352 [Bgs->Opn]: oci_close fails with global keyword

    ID: 39352
    User updated by: david at acz dot org
    Reported By: david at acz dot org
    -Status: Bogus
    +Status: Open
    -Bug Type: OCI8 related
    +Bug Type: Scripting Engine problem
    Operating System: SuSE Linux 9.3
    PHP Version: 5.2.0
    Assigned To: tony2001
    New Comment:

    Changing category.


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

    [2006-11-08 10:08:45] [email]tony2001@php.net[/email]

    Actually this has nothing to do with OCI8, as this is the way PHP
    handles resources.
    You can do the same trick with MySQL and it won't actually close the
    connection when using global variable, but it will work with $GLOBALS.


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

    [2006-11-06 08:50:31] anon at anon dot com

    reproduced on Windows 2003 server, using Nov 2 release of 5.2.0

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

    [2006-11-02 22:54:38] david at acz dot org

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via
    the "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null
    given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39352&edit=1[/url]
    david at acz dot org Guest

  7. #6

    Default #39352 [Opn->Bgs]: oci_close fails with global keyword

    ID: 39352
    Updated by: [email]iliaa@php.net[/email]
    Reported By: david at acz dot org
    -Status: Open
    +Status: Bogus
    Bug Type: Unknown/Other Function
    Operating System: SuSE Linux 9.3
    PHP Version: 5.2.0
    New Comment:

    Thank you for taking the time to write to us, but this is not
    a bug. Please double-check the documentation available at
    [url]http://www.php.net/manual/[/url] and the instructions on how to report
    a bug at [url]http://bugs.php.net/how-to-report.php[/url]

    ..


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

    [2006-11-09 14:55:54] david at acz dot org

    Changing category.

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

    [2006-11-08 10:08:45] [email]tony2001@php.net[/email]

    Actually this has nothing to do with OCI8, as this is the way PHP
    handles resources.
    You can do the same trick with MySQL and it won't actually close the
    connection when using global variable, but it will work with $GLOBALS.


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

    [2006-11-06 08:50:31] anon at anon dot com

    reproduced on Windows 2003 server, using Nov 2 release of 5.2.0

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

    [2006-11-02 22:54:38] david at acz dot org

    Description:
    ------------
    oci_close() fails if the connection resource is a global accessed via
    the "global" keyword, but works if accessed using the $GLOBALS array.

    Reproduce code:
    ---------------
    $conn = oci_connect(DB_USER, DB_PASS, DB_NAME);
    var_dump($conn);

    global_keyword();
    global_array();

    function global_keyword()
    {
    global $conn;
    var_dump($conn);
    oci_close($conn); // this seems to do nothing
    var_dump($conn);
    }

    function global_array()
    {
    var_dump($GLOBALS["conn"]);
    oci_close($GLOBALS["conn"]); // this works
    var_dump($GLOBALS["conn"]);
    }


    Expected result:
    ----------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL
    NULL
    PHP Warning: oci_close() expects parameter 1 to be resource, null
    given
    NULL


    Actual result:
    --------------
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    resource(8) of type (oci8 connection)
    NULL



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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39352&edit=1[/url]
    iliaa@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