From 8cf864ef1428872546bf98212412a1a62dce52d4 Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Tue, 23 Apr 2013 23:51:54 -0700 Subject: [PATCH] import zend pdo_sqlite tests --- .../test/zend/bad/ext-pdo_sqlite/bug43831.php | 38 +++++++++++ .../bad/ext-pdo_sqlite/bug43831.php.expectf | 8 +++ .../zend/bad/ext-pdo_sqlite/bug44327_2.php | 19 ++++++ .../bad/ext-pdo_sqlite/bug44327_2.php.expectf | 23 +++++++ .../zend/bad/ext-pdo_sqlite/bug44327_3.php | 13 ++++ .../bad/ext-pdo_sqlite/bug44327_3.php.expectf | 12 ++++ .../test/zend/bad/ext-pdo_sqlite/bug48773.php | 22 ++++++ .../bad/ext-pdo_sqlite/bug48773.php.expectf | 4 ++ .../test/zend/bad/ext-pdo_sqlite/bug50728.php | 7 ++ .../bad/ext-pdo_sqlite/bug50728.php.expectf | 1 + .../test/zend/bad/ext-pdo_sqlite/bug60104.php | 12 ++++ .../bad/ext-pdo_sqlite/bug60104.php.expectf | 1 + .../zend/bad/ext-pdo_sqlite/bug_42589.php | 13 ++++ .../bad/ext-pdo_sqlite/bug_42589.php.expectf | 2 + .../zend/bad/ext-pdo_sqlite/bug_63916-2.php | 16 +++++ .../ext-pdo_sqlite/bug_63916-2.php.expectf | 2 + .../zend/bad/ext-pdo_sqlite/bug_63916.php | 16 +++++ .../bad/ext-pdo_sqlite/bug_63916.php.expectf | 2 + .../ext-pdo_sqlite/debugdumpparams_001.php | 11 +++ .../debugdumpparams_001.php.expectf | 18 +++++ .../bad/ext-pdo_sqlite/pdo_fetch_func_001.php | 67 +++++++++++++++++++ .../pdo_fetch_func_001.php.expectf | 48 +++++++++++++ .../pdo_sqlite_createaggregate.php | 19 ++++++ .../pdo_sqlite_createaggregate.php.expectf | 6 ++ .../pdo_sqlite_createaggregate_002.php | 8 +++ ...pdo_sqlite_createaggregate_002.php.expectf | 2 + .../pdo_sqlite_createcollation.php | 26 +++++++ .../pdo_sqlite_createcollation.php.expectf | 6 ++ .../pdo_sqlite_createfunction.php | 20 ++++++ .../pdo_sqlite_createfunction.php.expectf | 12 ++++ .../pdo_sqlite_lastinsertid.php | 13 ++++ .../pdo_sqlite_lastinsertid.php.expectf | 13 ++++ .../zend/good/ext-pdo_sqlite/bug33841.php | 15 +++++ .../good/ext-pdo_sqlite/bug33841.php.expectf | 4 ++ .../zend/good/ext-pdo_sqlite/bug35336.php | 15 +++++ .../good/ext-pdo_sqlite/bug35336.php.expectf | 3 + .../zend/good/ext-pdo_sqlite/bug46139.php | 28 ++++++++ .../good/ext-pdo_sqlite/bug46139.php.expectf | 6 ++ .../zend/good/ext-pdo_sqlite/bug46542.php | 12 ++++ .../good/ext-pdo_sqlite/bug46542.php.expectf | 2 + .../zend/good/ext-pdo_sqlite/bug52487.php | 12 ++++ .../good/ext-pdo_sqlite/bug52487.php.expectf | 1 + .../test/zend/good/ext-pdo_sqlite/common.phpt | 12 ++++ .../pdo_sqlite_get_attribute.php | 7 ++ .../pdo_sqlite_get_attribute.php.expectf | 2 + .../ext-pdo_sqlite/pdo_sqlite_transaction.php | 21 ++++++ .../pdo_sqlite_transaction.php.expectf | 1 + hphp/tools/import_zend_test.py | 5 +- 48 files changed, 624 insertions(+), 2 deletions(-) create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php.expectf create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php create mode 100644 hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug33841.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug33841.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug35336.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug35336.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug46139.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug46139.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug46542.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug46542.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug52487.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/bug52487.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/common.phpt create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php.expectf create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php create mode 100644 hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php.expectf diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php new file mode 100644 index 000000000..7b6878934 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php @@ -0,0 +1,38 @@ + true)); + } +} + +class Baz extends PDO { + function __construct($dsn) { + parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true)); + } +} + +class Bar extends Baz { + function quux() { + echo get_class($this), "\n"; + $foo = new Foo("sqlite::memory:"); + echo get_class($this), "\n"; + } +} + +$bar = new Bar("sqlite::memory:"); +$bar->quux(); + + +class MyPDO extends PDO {} + +$bar = new PDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true)); +$baz = new MyPDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true)); + +var_dump($bar); +unset($bar); +var_dump($baz); +var_dump($bar); + + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php.expectf new file mode 100644 index 000000000..4c5276ac3 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug43831.php.expectf @@ -0,0 +1,8 @@ +Bar +Bar +object(MyPDO)#%d (0) { +} +object(MyPDO)#%d (0) { +} +HipHop Notice: %a +NULL \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php new file mode 100644 index 000000000..7fb0e6363 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php @@ -0,0 +1,19 @@ +query('select 1 as queryString'); +var_dump($x, $x->queryString); + +$y = $x->fetch(); +var_dump($y, @$y->queryString); + +print "--------------------------------------------\n"; + +$x = $db->query('select 1 as queryString'); +var_dump($x, $x->queryString); + +$y = $x->fetch(PDO::FETCH_LAZY); +var_dump($y, $y->queryString); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php.expectf new file mode 100644 index 000000000..f63bea2ba --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_2.php.expectf @@ -0,0 +1,23 @@ +object(PDOStatement)#%d (1) { + ["queryString"]=> + string(23) "select 1 as queryString" +} +string(23) "select 1 as queryString" +array(2) { + ["queryString"]=> + string(1) "1" + [0]=> + string(1) "1" +} +NULL +-------------------------------------------- +object(PDOStatement)#%d (1) { + ["queryString"]=> + string(23) "select 1 as queryString" +} +string(23) "select 1 as queryString" +object(PDORow)#%d (1) { + ["queryString"]=> + string(1) "1" +} +string(1) "1" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php new file mode 100644 index 000000000..a8320962a --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php @@ -0,0 +1,13 @@ +query('select 1 as queryStringxx'); +$y = $x->fetch(PDO::FETCH_LAZY); +var_dump($y, $y->queryString, $y->queryStringzz, $y->queryStringxx); + +print "---\n"; + +var_dump($y[5], $y->{3}); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php.expectf new file mode 100644 index 000000000..b5bf1037b --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug44327_3.php.expectf @@ -0,0 +1,12 @@ +object(PDORow)#%d (2) { + ["queryString"]=> + string(25) "select 1 as queryStringxx" + ["queryStringxx"]=> + string(1) "1" +} +string(25) "select 1 as queryStringxx" +NULL +string(1) "1" +--- +NULL +NULL \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php new file mode 100644 index 000000000..2a94b0670 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php @@ -0,0 +1,22 @@ +setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this))); + } +} + +$db = new foo('sqlite::memory:', '', ''); +$stmt = $db->query('SELECT 1'); +var_dump($stmt); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php.expectf new file mode 100644 index 000000000..927ed807d --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug48773.php.expectf @@ -0,0 +1,4 @@ +object(bar)#%d (1) { + [%u|b%"queryString"]=> + %unicode|string%(8) "SELECT 1" +} \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php new file mode 100644 index 000000000..daee81778 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php @@ -0,0 +1,7 @@ +getCode()); +} +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php.expectf new file mode 100644 index 000000000..833b9ef36 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug50728.php.expectf @@ -0,0 +1 @@ +int(14) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php new file mode 100644 index 000000000..890d2475e --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php @@ -0,0 +1,12 @@ +sqliteCreateFunction( "md5", "md5", 1 ); + unset( $handler ); +} + +setUp(); +setUp(); +echo "done"; +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php.expectf new file mode 100644 index 000000000..348ebd949 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug60104.php.expectf @@ -0,0 +1 @@ +done \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php new file mode 100644 index 000000000..9607cbc25 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php @@ -0,0 +1,13 @@ +exec('CREATE TABLE test (field1 VARCHAR(10))'); +$db->exec('INSERT INTO test VALUES("test")'); + +$result = $db->query('SELECT * FROM test t1 LEFT JOIN test t2 ON t1.field1 = t2.field1'); +$meta1 = $result->getColumnMeta(0); +$meta2 = $result->getColumnMeta(1); + +var_dump(!empty($meta1['table']) && $meta1['table'] == 'test'); +var_dump(!empty($meta2['table']) && $meta2['table'] == 'test'); +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php.expectf new file mode 100644 index 000000000..890dda841 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_42589.php.expectf @@ -0,0 +1,2 @@ +bool(true) +bool(true) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php new file mode 100644 index 000000000..c326d7533 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php @@ -0,0 +1,16 @@ +query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)'); +$stmt->bindValue(':id', 1, PDO::PARAM_INT); +$stmt->bindValue(':num', $num, PDO::PARAM_INT); +$stmt->execute(); + +$stmt = $conn->query('SELECT num FROM users'); +$result = $stmt->fetchAll(PDO::FETCH_COLUMN); + +var_dump($num,$result[0]); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php.expectf new file mode 100644 index 000000000..2333b06f4 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916-2.php.expectf @@ -0,0 +1,2 @@ +int(2147483647) +string(10) "2147483647" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php new file mode 100644 index 000000000..53b70528a --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php @@ -0,0 +1,16 @@ +query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))'); + +$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)'); +$stmt->bindValue(':id', 1, PDO::PARAM_INT); +$stmt->bindValue(':num', $num, PDO::PARAM_INT); +$stmt->execute(); + +$stmt = $conn->query('SELECT num FROM users'); +$result = $stmt->fetchAll(PDO::FETCH_COLUMN); + +var_dump($num,$result[0]); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php.expectf new file mode 100644 index 000000000..b0652b0b0 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/bug_63916.php.expectf @@ -0,0 +1,2 @@ +int(100004313234244) +string(15) "100004313234244" \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php b/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php new file mode 100644 index 000000000..24ccf57f0 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php @@ -0,0 +1,11 @@ +prepare('select :a, :b, ?'); +$x->bindValue(':a', 1, PDO::PARAM_INT); +$x->bindValue(':b', 'foo'); +$x->bindValue(3, 1313); +var_dump($x->debugDumpParams()); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php.expectf new file mode 100644 index 000000000..28943b3fe --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/debugdumpparams_001.php.expectf @@ -0,0 +1,18 @@ +SQL: [16] select :a, :b, ? +Params: 3 +Key: Name: [2] :a +paramno=-1 +name=[2] ":a" +is_param=1 +param_type=1 +Key: Name: [2] :b +paramno=-1 +name=[2] ":b" +is_param=1 +param_type=2 +Key: Position #2: +paramno=2 +name=[0] "" +is_param=1 +param_type=2 +NULL \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php new file mode 100644 index 000000000..a8ef9a6dd --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php @@ -0,0 +1,67 @@ +exec('CREATE TABLE testing (id INTEGER , name VARCHAR)'); +$db->exec('INSERT INTO testing VALUES(1, "php")'); +$db->exec('INSERT INTO testing VALUES(2, "")'); + +$st = $db->query('SELECT * FROM testing'); +$st->fetchAll(PDO::FETCH_FUNC, function($x, $y) use ($st) { var_dump($st); print "data: $x, $y\n"; }); + +$st = $db->query('SELECT name FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, 'strtoupper')); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, 'nothing')); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, '')); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, NULL)); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, 1)); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('self', 'foo'))); + +class foo { + public function foo($x) { + return "--- $x ---"; + } +} +class bar extends foo { + public function __construct($db) { + $st = $db->query('SELECT * FROM testing'); + var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::foo'))); + } + + static public function test($x, $y) { + return $x .'---'. $y; + } + + private function test2($x, $y) { + return $x; + } + + public function test3($x, $y) { + return $x .'==='. $y; + } +} + +new bar($db); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test'))); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test2'))); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'test3'))); + +$st = $db->query('SELECT * FROM testing'); +var_dump($st->fetchAll(PDO::FETCH_FUNC, array('bar', 'inexistent'))); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php.expectf new file mode 100644 index 000000000..41d9f7f7f --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_fetch_func_001.php.expectf @@ -0,0 +1,48 @@ +object(PDOStatement)#%d (1) { + [%u|b%"queryString"]=> + %string|unicode%(21) "SELECT * FROM testing" +} +data: 1, php +object(PDOStatement)#%d (1) { + [%u|b%"queryString"]=> + %string|unicode%(21) "SELECT * FROM testing" +} +data: 2, +array(2) { + [0]=> + %string|unicode%(3) "PHP" + [1]=> + %string|unicode%(0) "" +} +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +HipHop Warning: %a +bool(false) +array(2) { + [0]=> + %string|unicode%(9) "--- 1 ---" + [1]=> + %string|unicode%(9) "--- 2 ---" +} +array(2) { + [0]=> + %string|unicode%(7) "1---php" + [1]=> + %string|unicode%(4) "2---" +} +HipHop Warning: %a +bool(false) +array(2) { + [0]=> + %string|unicode%(7) "1===php" + [1]=> + %string|unicode%(4) "2===" +} +HipHop Warning: %a +bool(false) \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php new file mode 100644 index 000000000..0317b95e6 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php @@ -0,0 +1,19 @@ +query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); + +$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); + +$db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; }); + + +foreach ($db->query('SELECT testing(name) FROM foobar') as $row) { + var_dump($row); +} + +$db->query('DROP TABLE foobar'); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php.expectf new file mode 100644 index 000000000..9fe9b123d --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate.php.expectf @@ -0,0 +1,6 @@ +array(2) { + ["testing(name)"]=> + %string|unicode%(2) "12" + [0]=> + %string|unicode%(2) "12" +} \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php new file mode 100644 index 000000000..d450bedce --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php @@ -0,0 +1,8 @@ +sqliteCreateAggregate('foo', 'a', ''); +$pdo->sqliteCreateAggregate('foo', 'strlen', ''); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php.expectf new file mode 100644 index 000000000..55529a618 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createaggregate_002.php.expectf @@ -0,0 +1,2 @@ +HipHop Warning: %a +HipHop Warning: %a \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php new file mode 100644 index 000000000..c54de493c --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php @@ -0,0 +1,26 @@ +setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + +$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); + +$db->query('INSERT INTO foobar VALUES (NULL, "1")'); +$db->query('INSERT INTO foobar VALUES (NULL, "2")'); +$db->query('INSERT INTO foobar VALUES (NULL, "10")'); + +$db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); }); + +$result = $db->query('SELECT name FROM foobar ORDER BY name COLLATE MYCOLLATE'); +foreach ($result as $row) { + echo $row['name'] . "\n"; +} + +$result = $db->query('SELECT name FROM foobar ORDER BY name'); +foreach ($result as $row) { + echo $row['name'] . "\n"; +} + +$db->query('DROP TABLE foobar'); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php.expectf new file mode 100644 index 000000000..8b6088212 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createcollation.php.expectf @@ -0,0 +1,6 @@ +1 +2 +10 +1 +10 +2 \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php new file mode 100644 index 000000000..51be2a21d --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php @@ -0,0 +1,20 @@ +query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); + +$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); + + +$db->sqliteCreateFunction('testing', function($v) { return strtolower($v); }); + + +foreach ($db->query('SELECT testing(name) FROM foobar') as $row) { + var_dump($row); +} + +$db->query('DROP TABLE foobar'); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php.expectf new file mode 100644 index 000000000..361bdead5 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_createfunction.php.expectf @@ -0,0 +1,12 @@ +array(2) { + ["testing(name)"]=> + %string|unicode%(3) "php" + [0]=> + %string|unicode%(3) "php" +} +array(2) { + ["testing(name)"]=> + %string|unicode%(4) "php6" + [0]=> + %string|unicode%(4) "php6" +} \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php new file mode 100644 index 000000000..459b85a74 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php @@ -0,0 +1,13 @@ +query('CREATE TABLE IF NOT EXISTS foo (id INT AUTO INCREMENT, name TEXT)'); +$db->query('INSERT INTO foo VALUES (NULL, "PHP")'); +$db->query('INSERT INTO foo VALUES (NULL, "PHP6")'); +var_dump($db->query('SELECT * FROM foo')); +var_dump($db->errorInfo()); +var_dump($db->lastInsertId()); + +$db->query('DROP TABLE foo'); + +?> \ No newline at end of file diff --git a/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php.expectf b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php.expectf new file mode 100644 index 000000000..7907ad7e5 --- /dev/null +++ b/hphp/test/zend/bad/ext-pdo_sqlite/pdo_sqlite_lastinsertid.php.expectf @@ -0,0 +1,13 @@ +object(PDOStatement)#2 (1) { + ["queryString"]=> + %string|unicode%(17) "SELECT * FROM foo" +} +array(3) { + [0]=> + %string|unicode%(5) "00000" + [1]=> + NULL + [2]=> + NULL +} +%string|unicode%(1) "2" \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php b/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php new file mode 100644 index 000000000..db9999d18 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php @@ -0,0 +1,15 @@ +exec('CREATE TABLE test (text)'); + +$stmt = $db->prepare("INSERT INTO test VALUES ( :text )"); +$stmt->bindParam(':text', $name); +$name = 'test1'; +var_dump($stmt->execute(), $stmt->rowCount()); + +$stmt = $db->prepare("UPDATE test SET text = :text "); +$stmt->bindParam(':text', $name); +$name = 'test2'; +var_dump($stmt->execute(), $stmt->rowCount()); diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php.expectf new file mode 100644 index 000000000..7faac8dfa --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug33841.php.expectf @@ -0,0 +1,4 @@ +bool(true) +int(1) +bool(true) +int(1) \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php b/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php new file mode 100644 index 000000000..b399c970f --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php @@ -0,0 +1,15 @@ +query ("CREATE TABLE test (a integer primary key, b text)"); +$b = $a->prepare("insert into test (b) values (?)"); +$b->execute(array (5)); +$rez = $a->query ("SELECT * FROM test")->fetchAll(PDO::FETCH_CLASS, 'EEE'); + +echo "Done\n"; +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php.expectf new file mode 100644 index 000000000..cd5f58f75 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug35336.php.expectf @@ -0,0 +1,3 @@ +hello world +hello world +Done \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php b/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php new file mode 100644 index 000000000..4745d846c --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php @@ -0,0 +1,28 @@ +test); + } +} + +$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); +$r1 = $stmt->fetch(); +printf("'%s'\n", $r1->test); + +$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); +$r1 = $stmt->fetchAll(); +printf("'%s'\n", $r1[0]->test); + +$stmt = $db->query("SELECT 'foo' test, 1"); +$stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person'); +$r1 = $stmt->fetch(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE); +printf("'%s'\n", $r1->test); + +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php.expectf new file mode 100644 index 000000000..70efaac99 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug46139.php.expectf @@ -0,0 +1,6 @@ +NULL +'foo' +NULL +'foo' +NULL +'foo' \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php b/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php new file mode 100644 index 000000000..1a6c7077f --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php @@ -0,0 +1,12 @@ +truc(); +$a->TRUC(); + +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php.expectf new file mode 100644 index 000000000..3c2f3b999 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug46542.php.expectf @@ -0,0 +1,2 @@ +A::truc +A::TRUC \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php b/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php new file mode 100644 index 000000000..030731581 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php @@ -0,0 +1,12 @@ +prepare("select 1 as attr"); +for ($i = 0; $i < 10; $i++) { + $stmt->setFetchMode(PDO::FETCH_INTO, new stdClass); +} + +print "ok\n"; + +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php.expectf new file mode 100644 index 000000000..b5754e203 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/bug52487.php.expectf @@ -0,0 +1 @@ +ok \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/common.phpt b/hphp/test/zend/good/ext-pdo_sqlite/common.phpt new file mode 100644 index 000000000..65ea0c96f --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/common.phpt @@ -0,0 +1,12 @@ +--TEST-- +SQLite +--SKIPIF-- + +--REDIRECTTEST-- +return array( + 'ENV' => array( + 'PDOTEST_DSN' => 'sqlite::memory:' + ), + 'TESTS' => 'ext/pdo/tests' + ); diff --git a/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php new file mode 100644 index 000000000..371b58de4 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php @@ -0,0 +1,7 @@ +getAttribute(PDO::ATTR_SERVER_VERSION)); +var_dump($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION)); + +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php.expectf new file mode 100644 index 000000000..812a3a08f --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_get_attribute.php.expectf @@ -0,0 +1,2 @@ +string(%d) "%s" +string(%d) "%s" \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php new file mode 100644 index 000000000..5b807c2b7 --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php @@ -0,0 +1,21 @@ +beginTransaction(); + +$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)'); +$db->commit(); + +$db->beginTransaction(); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP")'); +$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")'); +$db->rollback(); + +$r = $db->query('SELECT COUNT(*) FROM foobar'); +var_dump($r->rowCount()); + + +$db->query('DROP TABLE foobar'); + +?> \ No newline at end of file diff --git a/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php.expectf b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php.expectf new file mode 100644 index 000000000..28fe0105d --- /dev/null +++ b/hphp/test/zend/good/ext-pdo_sqlite/pdo_sqlite_transaction.php.expectf @@ -0,0 +1 @@ +int(0) \ No newline at end of file diff --git a/hphp/tools/import_zend_test.py b/hphp/tools/import_zend_test.py index 50796264c..3ff1bb2e1 100755 --- a/hphp/tools/import_zend_test.py +++ b/hphp/tools/import_zend_test.py @@ -78,7 +78,6 @@ no_import = ( '/ext/xmlwriter/examples/', # not imported yet, but will be - '/ext/pdo_sqlite', '/ext/spl', '/ext/standard', @@ -213,6 +212,8 @@ other_files = ( '/ext-pdo/pdo_test.inc', '/ext-pdo_mysql/config.inc', '/ext-pdo_mysql/common.phpt', + '/ext-pdo_sqlite/config.inc', + '/ext-pdo_sqlite/common.phpt', '/ext-session/save_handler.inc', '/ext-simplexml/bug24392.xml', '/ext-soap-bugs/bug30928.wsdl', @@ -439,7 +440,7 @@ def walk(filename, source): test = test.replace("_002.xml", "_004.xml") if 'bug61139.php' in full_dest_filename: test += "\nunlink('someFile');\n?>" - if '/ext-pdo_mysql/' in full_dest_filename: + if '/ext-pdo_' in full_dest_filename: test = test.replace('/../../../ext/pdo/tests/pdo_test.inc', '/../ext-pdo/pdo_test.inc')