-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #81037 PDO discards error message text from prepared statement
- Loading branch information
1 parent
28e7add
commit 6afbb74
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--TEST-- | ||
Bug #81037 PDO discards error message text from prepared statement | ||
--SKIPIF-- | ||
<?php | ||
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); | ||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'skipif.inc'); | ||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); | ||
MySQLPDOTest::skip(); | ||
?> | ||
--FILE-- | ||
<?php | ||
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); | ||
|
||
$pdo = MySQLPDOTest::factory(); | ||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); | ||
MySQLPDOTest::createTestTable($pdo); | ||
|
||
$sql = "SELECT id FROM test WHERE label = :par"; | ||
$stmt = $pdo->prepare($sql); | ||
try { | ||
$stmt->execute(); | ||
} catch (PDOException $e) { | ||
echo $e->getMessage(), "\n"; | ||
} | ||
$data = $stmt->fetchAll(PDO::FETCH_ASSOC); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
require __DIR__ . '/mysql_pdo_test.inc'; | ||
MySQLPDOTest::dropTestTable(); | ||
?> | ||
--EXPECT-- | ||
SQLSTATE[HY000]: General error: 2031 No data supplied for parameters in prepared statement |
@kamil-tekiela, lines in NEWS should not exceed 80 (or better 79) characters. Also, the titles of bug reports should be enclosed in parentheses.