Annotation of embedaddon/php/ext/pdo/tests/bug_38253.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PDO Common: Bug #38253 (PDO produces segfault with default fetch mode)
! 3: --SKIPIF--
! 4: <?php # vim:ft=php
! 5: if (!extension_loaded('pdo')) die('skip');
! 6: $dir = getenv('REDIR_TEST_DIR');
! 7: if (false == $dir) die('skip no driver');
! 8: require_once $dir . 'pdo_test.inc';
! 9: PDOTest::skip();
! 10: ?>
! 11: --FILE--
! 12: <?php
! 13: if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
! 14: require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
! 15: $pdo = PDOTest::factory();
! 16:
! 17: $pdo->exec ("create table test (id integer primary key, n varchar(255))");
! 18: $pdo->exec ("INSERT INTO test (id, n) VALUES (1, 'hi')");
! 19:
! 20: $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_CLASS);
! 21: $stmt = $pdo->prepare ("SELECT * FROM test");
! 22: $stmt->execute();
! 23: var_dump($stmt->fetchAll());
! 24:
! 25: $pdo = PDOTest::factory();
! 26:
! 27: if ($pdo->getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
! 28: $type = "clob";
! 29: } else{
! 30: $type = "text";
! 31: }
! 32:
! 33: $pdo->exec ("create table test2 (id integer primary key, n $type)");
! 34: $pdo->exec ("INSERT INTO test2 (id, n) VALUES (1,'hi')");
! 35:
! 36: $pdo->setAttribute (PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_FUNC);
! 37: $stmt = $pdo->prepare ("SELECT * FROM test2");
! 38: $stmt->execute();
! 39: var_dump($stmt->fetchAll());
! 40:
! 41: ?>
! 42: --EXPECTF--
! 43: Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch class specified in %s on line %d
! 44:
! 45: Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error%s on line %d
! 46: array(0) {
! 47: }
! 48:
! 49: Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error: No fetch function specified in %s on line %d
! 50:
! 51: Warning: PDOStatement::fetchAll(): SQLSTATE[HY000]: General error%s on line %d
! 52: array(0) {
! 53: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>