Professional Web Applications Themes

#45798 [NEW]: sqlite3 doesn't notice if variable was bound - PHP Bugs

From: net Operating system: OSX PHP version: 5.3.0alpha1 PHP Bug Type: SQLite related Bug description: sqlite3 doesn't notice if variable was bound Description: ------------ If a prepared statement is executed while the bound variable doesn't exist, or is NULL, PHP freeze and wait. I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT, and NULL or !isset($foo) also froze PHP. Reproduce code: --------------- <?php $db = new SQLite3(':memory:'); // création d'une table $db->exec('CREATE TABLE test (time INTEGER, id STRING)'); $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')"); $db->exec("INSERT INTO test (time, id) VALUES (" . ...

  1. #1

    Default #45798 [NEW]: sqlite3 doesn't notice if variable was bound

    From: net
    Operating system: OSX
    PHP version: 5.3.0alpha1
    PHP Bug Type: SQLite related
    Bug description: sqlite3 doesn't notice if variable was bound

    Description:
    ------------
    If a prepared statement is executed while the bound variable doesn't
    exist, or is NULL, PHP freeze and wait.

    I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT, and
    NULL or !isset($foo) also froze PHP.

    Reproduce code:
    ---------------
    <?php
    $db = new SQLite3(':memory:');

    // création d'une table
    $db->exec('CREATE TABLE test (time INTEGER, id STRING)');

    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

    $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");

    //$foo = 'a'; works OK
    //$foo = NULL; also freeze
    $stmt->bindParam(1, $foo, SQLITE3_TEXT);
    $results = $stmt->execute();
    while ($result = $results->fetchArray(SQLITE3_NUM))
    {
    var_dump($result);
    }
    $results->finalize();

    $db->close();
    ?>



    Expected result:
    ----------------
    I would expect PHP to return from execute with an error.

    Actual result:
    --------------
    PHP freeze, doing nothing.

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

    dams@php.net Guest

  2. #2

    Default #45798 [Opn->Asn]: sqlite3 doesn't notice if variable was bound

    ID: 45798
    Updated by: net
    Reported By: net
    -Status: Open
    +Status: Assigned
    Bug Type: SQLite related
    Operating System: OSX
    PHP Version: 5.3.0alpha1
    -Assigned To:
    +Assigned To: scottmac
    New Comment:

    Assign to maintainer


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

    [2008-08-12 13:11:17] net

    Description:
    ------------
    If a prepared statement is executed while the bound variable doesn't
    exist, or is NULL, PHP freeze and wait.

    I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT,
    and
    NULL or !isset($foo) also froze PHP.

    Reproduce code:
    ---------------
    <?php
    $db = new SQLite3(':memory:');

    // création d'une table
    $db->exec('CREATE TABLE test (time INTEGER, id STRING)');

    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

    $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id
    ASC");

    //$foo = 'a'; works OK
    //$foo = NULL; also freeze
    $stmt->bindParam(1, $foo, SQLITE3_TEXT);
    $results = $stmt->execute();
    while ($result = $results->fetchArray(SQLITE3_NUM))
    {
    var_dump($result);
    }
    $results->finalize();

    $db->close();
    ?>



    Expected result:
    ----------------
    I would expect PHP to return from execute with an error.

    Actual result:
    --------------
    PHP freeze, doing nothing.


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


    --
    Edit this bug report at http://bugs.php.net/?id=45798&edit=1

    johannes@php.net Guest

  3. #3

    Default #45798 [Asn->Csd]: sqlite3 doesn't notice if variable was bound

    ID: 45798
    Updated by: net
    Reported By: net
    -Status: Assigned
    +Status: Closed
    Bug Type: SQLite related
    Operating System: OSX
    PHP Version: 5.3.0alpha1
    Assigned To: scottmac
    New Comment:

    This bug has been fixed in CVS.

    Snapshots of the sources are packaged every three hours; this change
    will be in the next snapshot. You can grab the snapshot at
    http://snaps.php.net/.

    Thank you for the report, and for helping us make PHP better.

    I'm not the maintainer, but as it's a simple fix, I commited it, ok
    Scott? :)


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

    [2008-08-12 13:31:33] net

    Assign to maintainer

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

    [2008-08-12 13:11:17] net

    Description:
    ------------
    If a prepared statement is executed while the bound variable doesn't
    exist, or is NULL, PHP freeze and wait.

    I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT,
    and
    NULL or !isset($foo) also froze PHP.

    Reproduce code:
    ---------------
    <?php
    $db = new SQLite3(':memory:');

    // création d'une table
    $db->exec('CREATE TABLE test (time INTEGER, id STRING)');

    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

    $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id
    ASC");

    //$foo = 'a'; works OK
    //$foo = NULL; also freeze
    $stmt->bindParam(1, $foo, SQLITE3_TEXT);
    $results = $stmt->execute();
    while ($result = $results->fetchArray(SQLITE3_NUM))
    {
    var_dump($result);
    }
    $results->finalize();

    $db->close();
    ?>



    Expected result:
    ----------------
    I would expect PHP to return from execute with an error.

    Actual result:
    --------------
    PHP freeze, doing nothing.


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


    --
    Edit this bug report at http://bugs.php.net/?id=45798&edit=1

    felipe@php.net Guest

  4. #4

    Default #45798 [Csd]: sqlite3 doesn't notice if variable was bound

    ID: 45798
    Updated by: net
    Reported By: net
    Status: Closed
    Bug Type: SQLite related
    Operating System: OSX
    PHP Version: 5.3.0alpha1
    Assigned To: scottmac
    New Comment:

    Sure, I don't mind anyone fixing things.


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

    [2008-08-12 13:36:22] net

    This bug has been fixed in CVS.

    Snapshots of the sources are packaged every three hours; this change
    will be in the next snapshot. You can grab the snapshot at
    http://snaps.php.net/.

    Thank you for the report, and for helping us make PHP better.

    I'm not the maintainer, but as it's a simple fix, I commited it, ok
    Scott? :)

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

    [2008-08-12 13:31:33] net

    Assign to maintainer

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

    [2008-08-12 13:11:17] net

    Description:
    ------------
    If a prepared statement is executed while the bound variable doesn't
    exist, or is NULL, PHP freeze and wait.

    I tweaked the test also to use SQLITE3_NULL instead of SQLITE3_TEXT,
    and
    NULL or !isset($foo) also froze PHP.

    Reproduce code:
    ---------------
    <?php
    $db = new SQLite3(':memory:');

    // création d'une table
    $db->exec('CREATE TABLE test (time INTEGER, id STRING)');

    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'a')");
    $db->exec("INSERT INTO test (time, id) VALUES (" . time() . ", 'b')");

    $stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id
    ASC");

    //$foo = 'a'; works OK
    //$foo = NULL; also freeze
    $stmt->bindParam(1, $foo, SQLITE3_TEXT);
    $results = $stmt->execute();
    while ($result = $results->fetchArray(SQLITE3_NUM))
    {
    var_dump($result);
    }
    $results->finalize();

    $db->close();
    ?>



    Expected result:
    ----------------
    I would expect PHP to return from execute with an error.

    Actual result:
    --------------
    PHP freeze, doing nothing.


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


    --
    Edit this bug report at http://bugs.php.net/?id=45798&edit=1

    scottmac@php.net Guest

Similar Threads

  1. Undefined variable notice error
    By Doug in forum PHP Development
    Replies: 1
    Last Post: May 11th, 03:12 PM
  2. #20837 [Com]: Undefined variable notice
    By parkhurst in forum PHP Development
    Replies: 2
    Last Post: January 9th, 06:39 PM
  3. Notice: Undefined variable
    By PONTEPRIMO in forum PHP Development
    Replies: 1
    Last Post: November 7th, 09:56 PM
  4. PHP Notice: Undefined variable
    By Nabil in forum PHP Development
    Replies: 4
    Last Post: October 4th, 01:43 PM
  5. Help: Notice: Undefined variable: edit in.....
    By Tim Dixon in forum PHP Development
    Replies: 1
    Last Post: July 11th, 08:44 AM

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
  •  

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