Annotation of embedaddon/php/ext/pdo_mysql/tests/bug53782.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PDO MySQL Bug #53782 (foreach throws irrelevant exception)
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
! 6: require dirname(__FILE__) . '/config.inc';
! 7: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
! 8: PDOTest::skip();
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: require dirname(__FILE__) . '/config.inc';
! 13: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
! 14: $conn = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
! 15:
! 16: $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
! 17:
! 18: $res = $conn->query('SELECT 0');
! 19:
! 20: try {
! 21: $conn->query('ERROR');
! 22: } catch (PDOException $e) {
! 23: echo "Caught: ".$e->getMessage()."\n";
! 24: }
! 25:
! 26: foreach ($res as $k => $v) {
! 27: echo "Value: $v[0]\n";
! 28: }
! 29:
! 30: echo "DONE";
! 31: ?>
! 32: --CLEAN--
! 33: <?php
! 34: require dirname(__FILE__) . '/mysql_pdo_test.inc';
! 35: MySQLPDOTest::dropTestTable();
! 36: ?>
! 37: --EXPECTF--
! 38: Caught: SQLSTATE[42000]: %s
! 39: Value: 0
! 40: DONE
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>