mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Fix Bug #53782 (foreach throws irrelevant exception)
This commit is contained in:
parent
9e5bc2c138
commit
3e17b49008
3 changed files with 46 additions and 1 deletions
1
NEWS
1
NEWS
|
@ -85,6 +85,7 @@ PHP NEWS
|
||||||
|
|
||||||
- PDO MySQL driver:
|
- PDO MySQL driver:
|
||||||
. Fixed bug #54644 (wrong pathes in php_pdo_mysql_int.h). (Tony, Johannes)
|
. Fixed bug #54644 (wrong pathes in php_pdo_mysql_int.h). (Tony, Johannes)
|
||||||
|
. Fixed bug #53782 (foreach throws irrelevant exception). (Johannes, Andrey)
|
||||||
. Implemented FR #48587 (MySQL PDO driver doesn't support SSL connections).
|
. Implemented FR #48587 (MySQL PDO driver doesn't support SSL connections).
|
||||||
(Rob)
|
(Rob)
|
||||||
|
|
||||||
|
|
|
@ -656,7 +656,11 @@ static int pdo_mysql_stmt_fetch(pdo_stmt_t *stmt,
|
||||||
#endif /* PDO_USE_MYSQLND */
|
#endif /* PDO_USE_MYSQLND */
|
||||||
|
|
||||||
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
|
if ((S->current_data = mysql_fetch_row(S->result)) == NULL) {
|
||||||
if (mysql_errno(S->H->server)) {
|
#if PDO_USE_MYSQLND
|
||||||
|
if (S->result->unbuf && !S->result->unbuf->eof_reached && mysql_errno(S->H->server)) {
|
||||||
|
#else
|
||||||
|
if (!S->result->eof && mysql_errno(S->H->server)) {
|
||||||
|
#endif
|
||||||
pdo_mysql_error_stmt(stmt);
|
pdo_mysql_error_stmt(stmt);
|
||||||
}
|
}
|
||||||
PDO_DBG_RETURN(0);
|
PDO_DBG_RETURN(0);
|
||||||
|
|
40
ext/pdo_mysql/tests/bug53782.phpt
Normal file
40
ext/pdo_mysql/tests/bug53782.phpt
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
--TEST--
|
||||||
|
PDO MySQL Bug #53782 (foreach throws irrelevant exception)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
PDOTest::skip();
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
require dirname(__FILE__) . '/config.inc';
|
||||||
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
||||||
|
$conn = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
||||||
|
|
||||||
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
|
||||||
|
$res = $conn->query('SELECT 0');
|
||||||
|
|
||||||
|
try {
|
||||||
|
$conn->query('ERROR');
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
echo "Caught: ".$e->getMessage()."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($res as $k => $v) {
|
||||||
|
echo "Value: $v[0]\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "DONE";
|
||||||
|
?>
|
||||||
|
--CLEAN--
|
||||||
|
<?php
|
||||||
|
require dirname(__FILE__) . '/mysql_pdo_test.inc';
|
||||||
|
MySQLPDOTest::dropTestTable();
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Caught: SQLSTATE[42000]: %s
|
||||||
|
Value: 0
|
||||||
|
DONE
|
Loading…
Add table
Add a link
Reference in a new issue