PHP  
 PHP_5_4
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/pdo_odbc/tests/bug_39656.phpt ('ODBC PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor())')

Script

1: <?php
2:
3:
if (getenv('REDIR_TEST_DIR') === falseputenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
4: require_once 
getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
5:
$db PDOTest::factory();
6:
7: @
$db->exec("DROP TABLE test");
8:
$db->setAttribute(PDO::ATTR_ERRMODEPDO::ERRMODE_EXCEPTION);
9:
10:
$db->exec("CREATE TABLE test (id INTEGER NOT NULL PRIMARY KEY, usr VARCHAR( 256 ) NOT NULL)");
11:
$db->exec("INSERT INTO test (id, usr) VALUES (1, 'user')");
12:
13:
$stmt $db->prepare("SELECT * FROM test WHERE id = ?");
14:
$stmt->bindValue(11PDO::PARAM_INT );
15:
$stmt->execute();
16:
$row $stmt->fetch();
17:
var_dump$row );
18:
19:
$stmt->execute();
20:
$stmt->closeCursor();
21:
$row $stmt->fetch(); // this line will crash CLI
22:
var_dump$row );
23:
24: @
$db->exec("DROP TABLE test");
25: echo 
"Done\n";
26:
?>
27:

Expected

array(4) {
  ["id"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
  ["usr"]=>
  string(4) "user"
  [1]=>
  string(4) "user"
}
bool(false)
Done

Output

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_4/ext/pdo_odbc/odbc_stmt.c:254)' in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php:15
Stack trace:
#0 /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php(15): PDOStatement->execute()
#1 {main}
  thrown in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php on line 15

Diff

# original source file: ext/pdo/tests/bug_39656.phpt
001+ Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_4/ext/pdo_odbc/odbc_stmt.c:254)' in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php:15
002+ Stack trace:
003+ #0 /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php(15): PDOStatement->execute()
004+ #1 {main}
005+   thrown in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/bug_39656.php on line 15
001- array(4) {
002-   ["id"]=>
003-   string(1) "1"
004-   [0]=>
005-   string(1) "1"
006-   ["usr"]=>
007-   string(4) "user"
008-   [1]=>
009-   string(4) "user"
010- }
011- bool(false)
012- Done

 

Generated at Tue, 15 Jul 2014 20:53:37 +0000 (8 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.