diff --git a/ext/pgsql/tests/00version.phpt b/ext/pgsql/tests/00version.phpt index 84cbb1b50655b..97494a451b691 100644 --- a/ext/pgsql/tests/00version.phpt +++ b/ext/pgsql/tests/00version.phpt @@ -3,12 +3,12 @@ PostgreSQL version --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- =') && (!($q = @pg_query($db, "SELECT * FROM ".$table_name_92)) || !@pg_num_rows($q))) { - pg_query($db,$table_def_92); // Create table here + pg_query($db, "CREATE TABLE {$table_name_92} (textary text[], jsn json)"); // Create table here } else { echo pg_last_error()."\n"; } // Create view here -pg_query($db,$view_def); +pg_query($db, "CREATE VIEW {$view_name} AS SELECT * FROM {$table_name}"); pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/02connection.phpt b/ext/pgsql/tests/02connection.phpt index 6227066cf5681..4229c150f6d8c 100644 --- a/ext/pgsql/tests/02connection.phpt +++ b/ext/pgsql/tests/02connection.phpt @@ -3,12 +3,12 @@ PostgreSQL connection --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- +--CLEAN-- + --EXPECT-- Argument #3 must be greater than or equal to 0 Argument #3 must be less than the number of fields for this result set diff --git a/ext/pgsql/tests/04async_query.phpt b/ext/pgsql/tests/04async_query.phpt index 2bbfbe846a83e..70a5f47c3f270 100644 --- a/ext/pgsql/tests/04async_query.phpt +++ b/ext/pgsql/tests/04async_query.phpt @@ -3,13 +3,16 @@ PostgreSQL async query --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/05large_object.phpt b/ext/pgsql/tests/05large_object.phpt index f4488ca5aa522..a785b76a572d3 100644 --- a/ext/pgsql/tests/05large_object.phpt +++ b/ext/pgsql/tests/05large_object.phpt @@ -3,26 +3,26 @@ PostgreSQL large object --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- 0); +?> +--CLEAN-- + --EXPECT-- string(5) "array" diff --git a/ext/pgsql/tests/06copy.phpt b/ext/pgsql/tests/06copy.phpt index 9088bf6970b67..e85ae767c5de6 100644 --- a/ext/pgsql/tests/06copy.phpt +++ b/ext/pgsql/tests/06copy.phpt @@ -3,13 +3,15 @@ PostgreSQL copy functions --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/06copy_2.phpt b/ext/pgsql/tests/06copy_2.phpt index 714e4fb056b7d..a6ad92cd8d664 100644 --- a/ext/pgsql/tests/06copy_2.phpt +++ b/ext/pgsql/tests/06copy_2.phpt @@ -3,27 +3,33 @@ PostgreSQL copy functions, part 2 --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt index ac57cd4240096..f749b545efc10 100644 --- a/ext/pgsql/tests/07optional.phpt +++ b/ext/pgsql/tests/07optional.phpt @@ -3,12 +3,12 @@ PostgreSQL optional functions --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- +--CLEAN-- + --EXPECTF-- Deprecated: pg_escape_string(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt index c27f010f07cc2..3fd7ae411c7a4 100644 --- a/ext/pgsql/tests/09notice.phpt +++ b/ext/pgsql/tests/09notice.phpt @@ -5,15 +5,15 @@ pgsql --SKIPIF-- --FILE-- --FILE-- --FILE-- '1234', 'str'=>'AAA', 'bin'=>'BBB'); @@ -49,6 +52,14 @@ try { echo $e->getMessage(), \PHP_EOL; } ?> +--CLEAN-- + --EXPECT-- array(3) { [""num""]=> diff --git a/ext/pgsql/tests/10pg_convert_json_array.phpt b/ext/pgsql/tests/10pg_convert_json_array.phpt index 918765db06c5c..d1acc686d8909 100644 --- a/ext/pgsql/tests/10pg_convert_json_array.phpt +++ b/ext/pgsql/tests/10pg_convert_json_array.phpt @@ -4,16 +4,18 @@ PostgreSQL pg_convert() and JSON/Array pgsql --SKIPIF-- --FILE-- '{"meeting", "lunch", "training", "presentation"}', @@ -28,6 +30,14 @@ if (!pg_insert($db, $table_name_92, $fields)) { echo "OK\n"; } +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/11pg_meta_data.phpt b/ext/pgsql/tests/11pg_meta_data.phpt index fb595023a2a09..a1cad68d39212 100644 --- a/ext/pgsql/tests/11pg_meta_data.phpt +++ b/ext/pgsql/tests/11pg_meta_data.phpt @@ -3,19 +3,29 @@ PostgreSQL pg_metadata() --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- array(3) { ["num"]=> diff --git a/ext/pgsql/tests/12pg_insert.phpt b/ext/pgsql/tests/12pg_insert.phpt index 96d8c2f923a05..ff7d412b1006e 100644 --- a/ext/pgsql/tests/12pg_insert.phpt +++ b/ext/pgsql/tests/12pg_insert.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_insert() pgsql --SKIPIF-- --FILE-- '1234', 'str'=>'AAA', 'bin'=>'BBB'); diff --git a/ext/pgsql/tests/12pg_insert_9.phpt b/ext/pgsql/tests/12pg_insert_9.phpt index 892494fe6f0a9..b986d14e15dca 100644 --- a/ext/pgsql/tests/12pg_insert_9.phpt +++ b/ext/pgsql/tests/12pg_insert_9.phpt @@ -4,16 +4,19 @@ PostgreSQL pg_insert() (9.0+) pgsql --SKIPIF-- --FILE-- '1234', 'str'=>'AAA', 'bin'=>'BBB'); @@ -53,9 +56,17 @@ try { echo "Ok\n"; ?> +--CLEAN-- + --EXPECTF-- -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); -INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES ('1234','AAA','BBB'); +INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242'); +INSERT INTO "table_12pg_insert_9" ("num","str","bin") VALUES ('1234','AAA','BBB'); object(PgSql\Result)#%d (0) { } Array of values must be an associative array with string keys diff --git a/ext/pgsql/tests/13pg_select.phpt b/ext/pgsql/tests/13pg_select.phpt index 60c31dd8f951b..fe912360380ab 100644 --- a/ext/pgsql/tests/13pg_select.phpt +++ b/ext/pgsql/tests/13pg_select.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_select() pgsql --SKIPIF-- ='); ?> --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); diff --git a/ext/pgsql/tests/13pg_select_9.phpt b/ext/pgsql/tests/13pg_select_9.phpt index 9246288e5c8c0..028215f5d8000 100644 --- a/ext/pgsql/tests/13pg_select_9.phpt +++ b/ext/pgsql/tests/13pg_select_9.phpt @@ -4,19 +4,23 @@ PostgreSQL pg_select() (9.0+) pgsql --SKIPIF-- --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); $ids = array('num'=>'1234'); $res = pg_select($db, $table_name, $ids) or print "Error\n"; @@ -54,6 +58,14 @@ try { echo "Ok\n"; +?> +--CLEAN-- + --EXPECT-- array(2) { @@ -76,8 +88,8 @@ array(2) { string(8) "\x424242" } } -SELECT * FROM "php_pgsql_test" WHERE "num"=1234; -SELECT * FROM "php_pgsql_test" WHERE "num"='1234'; +SELECT * FROM "table_13pg_select_9" WHERE "num"=1234; +SELECT * FROM "table_13pg_select_9" WHERE "num"='1234'; Array of values must be an associative array with string keys Array of values must be an associative array with string keys Values must be of type string|int|float|bool|null, array given diff --git a/ext/pgsql/tests/14pg_update.phpt b/ext/pgsql/tests/14pg_update.phpt index 9691ee3d8624b..b0aa0793f3ed0 100644 --- a/ext/pgsql/tests/14pg_update.phpt +++ b/ext/pgsql/tests/14pg_update.phpt @@ -4,14 +4,14 @@ PostgreSQL pg_update() pgsql --SKIPIF-- --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); diff --git a/ext/pgsql/tests/14pg_update_9.phpt b/ext/pgsql/tests/14pg_update_9.phpt index d34f05216ec45..602019c2fb621 100644 --- a/ext/pgsql/tests/14pg_update_9.phpt +++ b/ext/pgsql/tests/14pg_update_9.phpt @@ -4,16 +4,21 @@ PostgreSQL pg_update() (9.0+) pgsql --SKIPIF-- --FILE-- '1234', 'str'=>'ABC', 'bin'=>'XYZ'); @@ -25,7 +30,15 @@ echo pg_update($db, $table_name, $fields, $ids, PGSQL_DML_STRING|PGSQL_DML_ESCAP echo "Ok\n"; ?> +--CLEAN-- + --EXPECT-- -UPDATE "php_pgsql_test" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; -UPDATE "php_pgsql_test" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234'; +UPDATE "table_14pg_update_9" SET "num"=1234,"str"=E'ABC',"bin"=E'\\x58595a' WHERE "num"=1234; +UPDATE "table_14pg_update_9" SET "num"='1234',"str"='ABC',"bin"='XYZ' WHERE "num"='1234'; Ok diff --git a/ext/pgsql/tests/15pg_delete.phpt b/ext/pgsql/tests/15pg_delete.phpt index bd60a5a8fb5f5..206971debf268 100644 --- a/ext/pgsql/tests/15pg_delete.phpt +++ b/ext/pgsql/tests/15pg_delete.phpt @@ -3,14 +3,18 @@ PostgreSQL pg_delete() --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- '1234', 'str'=>'XXX', 'bin'=>'YYY'); $ids = array('num'=>'1234'); @@ -23,7 +27,15 @@ else { echo "Ok\n"; } ?> +--CLEAN-- + --EXPECT-- -DELETE FROM "php_pgsql_test" WHERE "num"=1234; -DELETE FROM "php_pgsql_test" WHERE "num"='1234'; +DELETE FROM "table_15pg_delete" WHERE "num"=1234; +DELETE FROM "table_15pg_delete" WHERE "num"='1234'; Ok diff --git a/ext/pgsql/tests/16pg_result_status.phpt b/ext/pgsql/tests/16pg_result_status.phpt index 124c37a721e7c..318ba707b970e 100644 --- a/ext/pgsql/tests/16pg_result_status.phpt +++ b/ext/pgsql/tests/16pg_result_status.phpt @@ -3,12 +3,14 @@ PostgreSQL pg_result_status() --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- 1 COMMIT diff --git a/ext/pgsql/tests/17result.phpt b/ext/pgsql/tests/17result.phpt index 15cdceb52b4b7..4025f2605be38 100644 --- a/ext/pgsql/tests/17result.phpt +++ b/ext/pgsql/tests/17result.phpt @@ -3,14 +3,18 @@ PostgreSQL pg_fetch_*() functions --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECTF-- bool(true) object(stdClass)#%d (3) { diff --git a/ext/pgsql/tests/18pg_escape_bytea_before.phpt b/ext/pgsql/tests/18pg_escape_bytea_before.phpt index c55fdf3ba4d66..5c7e755dcaea6 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_before.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_before.phpt @@ -3,17 +3,20 @@ PostgreSQL pg_escape_bytea() functions (before connection) --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECTF-- Deprecated: pg_escape_bytea(): Automatic fetching of PostgreSQL connection is deprecated in %s on line %d OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt index 57cdf9e2378d8..55f6e5d9bc467 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_esc.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_esc.phpt @@ -3,14 +3,17 @@ PostgreSQL pg_escape_bytea() functions (escape format) --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt index 4d68030e6f035..eb43c10dc0569 100644 --- a/ext/pgsql/tests/18pg_escape_bytea_hex.phpt +++ b/ext/pgsql/tests/18pg_escape_bytea_hex.phpt @@ -4,16 +4,19 @@ PostgreSQL pg_escape_bytea() functions (hex format) pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/19pg_ping.phpt b/ext/pgsql/tests/19pg_ping.phpt index 5b06ee88f85f2..c27649b42d1e1 100644 --- a/ext/pgsql/tests/19pg_ping.phpt +++ b/ext/pgsql/tests/19pg_ping.phpt @@ -3,12 +3,12 @@ PostgreSQL pg_ping() functions --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- +--CLEAN-- + --EXPECTF-- test_class::__construct(1,2) object(test_class)#%d (3) { diff --git a/ext/pgsql/tests/23sync_query_params.phpt b/ext/pgsql/tests/23sync_query_params.phpt index b3fa1d4adc835..a4be57102f656 100644 --- a/ext/pgsql/tests/23sync_query_params.phpt +++ b/ext/pgsql/tests/23sync_query_params.phpt @@ -4,15 +4,19 @@ PostgreSQL sync query params pgsql --SKIPIF-- --FILE-- \$1;", array(100)); if (!($rows = pg_num_rows($result))) { @@ -39,7 +43,7 @@ pg_result_error($result); pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, null, 0); @@ -53,5 +57,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/24sync_query_prepared.phpt b/ext/pgsql/tests/24sync_query_prepared.phpt index 92bb6ac8f6122..bafb182827303 100644 --- a/ext/pgsql/tests/24sync_query_prepared.phpt +++ b/ext/pgsql/tests/24sync_query_prepared.phpt @@ -4,15 +4,18 @@ PostgreSQL sync prepared queries pgsql --SKIPIF-- --FILE-- \$1;"); pg_result_error($result); @@ -43,7 +46,7 @@ pg_result_error($result); pg_num_rows(pg_execute($db, "php_test", array(100))); pg_num_fields(pg_execute($db, "php_test", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); @@ -60,5 +63,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/25async_query_params.phpt b/ext/pgsql/tests/25async_query_params.phpt index 1c33160a5a480..26531f991a849 100644 --- a/ext/pgsql/tests/25async_query_params.phpt +++ b/ext/pgsql/tests/25async_query_params.phpt @@ -4,15 +4,19 @@ PostgreSQL async query params pgsql --SKIPIF-- --FILE-- \$1;", array(100))) { echo "pg_send_query_params() error\n"; } @@ -47,7 +51,7 @@ for ($i=0; $i < $rows; $i++) pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); @@ -64,5 +68,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/26async_query_prepared.phpt b/ext/pgsql/tests/26async_query_prepared.phpt index 8f0adb6cda262..31b53f531a394 100644 --- a/ext/pgsql/tests/26async_query_prepared.phpt +++ b/ext/pgsql/tests/26async_query_prepared.phpt @@ -4,15 +4,19 @@ PostgreSQL async prepared queries pgsql --SKIPIF-- --FILE-- \$1;")) { echo "pg_send_prepare() error\n"; } @@ -61,7 +65,7 @@ for ($i=0; $i < $rows; $i++) pg_num_rows(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); @@ -100,5 +104,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/27large_object_oid.phpt b/ext/pgsql/tests/27large_object_oid.phpt index 4581d18a88080..079c29608c3b7 100644 --- a/ext/pgsql/tests/27large_object_oid.phpt +++ b/ext/pgsql/tests/27large_object_oid.phpt @@ -4,7 +4,7 @@ PostgreSQL create large object with given oid pgsql --SKIPIF-- 0) die("skip - requires pg client >= 8.3\n"); if (version_compare("8.3", $v["server"]) > 0) die("skip - requires pg server >= 8.3\n"); @@ -12,33 +12,33 @@ if (version_compare("8.3", $v["server"]) > 0) die("skip - requires pg server >= --FILE-- diff --git a/ext/pgsql/tests/28large_object_import_oid.phpt b/ext/pgsql/tests/28large_object_import_oid.phpt index 13a0918d84879..6449a2b00f7fe 100644 --- a/ext/pgsql/tests/28large_object_import_oid.phpt +++ b/ext/pgsql/tests/28large_object_import_oid.phpt @@ -4,7 +4,7 @@ PostgreSQL import large object with given oid pgsql --SKIPIF-- 0) die("skip - requires pg client >= 8.4\n"); if (version_compare("8.4devel", $v["server"]) > 0) die("skip - requires pg server >= 8.4\n"); @@ -12,33 +12,33 @@ if (version_compare("8.4devel", $v["server"]) > 0) die("skip - requires pg serve --FILE-- --FILE-- --FILE-- \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); @@ -69,5 +73,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/31nb_async_query_prepared.phpt b/ext/pgsql/tests/31nb_async_query_prepared.phpt index 42020181aa723..50161827a9694 100644 --- a/ext/pgsql/tests/31nb_async_query_prepared.phpt +++ b/ext/pgsql/tests/31nb_async_query_prepared.phpt @@ -4,16 +4,20 @@ PostgreSQL non-blocking async prepared queries pgsql --SKIPIF-- --FILE-- \$1;", array(100))); pg_num_fields(pg_query_params($db, "SELECT * FROM ".$table_name." WHERE num > \$1;", array(100))); pg_field_name($result, 0); -pg_field_num($result, $field_name); +pg_field_num($result, "num"); pg_field_size($result, 0); pg_field_type($result, 0); pg_field_prtlen($result, 0); @@ -102,5 +106,13 @@ pg_close($db); echo "OK"; ?> +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/32nb_async_query.phpt b/ext/pgsql/tests/32nb_async_query.phpt index 634e6f04dbbd5..0cdac72cf3100 100644 --- a/ext/pgsql/tests/32nb_async_query.phpt +++ b/ext/pgsql/tests/32nb_async_query.phpt @@ -4,16 +4,20 @@ PostgreSQL non-blocking async queries pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index f17af830d7041..93118d0e6d262 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -7,11 +7,11 @@ pgsql --FILE-- --FILE-- +--CLEAN-- + --EXPECTF-- Array diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt index b296c4e85ad81..0c9a2b5b10702 100644 --- a/ext/pgsql/tests/80_bug27597.phpt +++ b/ext/pgsql/tests/80_bug27597.phpt @@ -4,23 +4,23 @@ Bug #27597 (pg_fetch_array not returning false) pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- Array diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt index 2a1ef631c0df6..06627eb4561a7 100644 --- a/ext/pgsql/tests/80_bug32223.phpt +++ b/ext/pgsql/tests/80_bug32223.phpt @@ -4,7 +4,7 @@ Bug #32223 (weird behaviour of pg_last_notice) pgsql --SKIPIF-- --FILE-- --FILE-- 'now()'); -pg_insert($dbh, 'php_test', $values); +pg_insert($dbh, $table_name, $values); $ids = array('id' => 1); -pg_update($dbh, 'php_test', $values, $ids); +pg_update($dbh, $table_name, $values, $ids); -pg_query($dbh, "DROP TABLE php_test"); pg_close($dbh); ?> ===DONE=== +--CLEAN-- + --EXPECT-- ===DONE=== diff --git a/ext/pgsql/tests/80_bug42783.phpt b/ext/pgsql/tests/80_bug42783.phpt index 4a15f62e9e653..cdce536d87597 100644 --- a/ext/pgsql/tests/80_bug42783.phpt +++ b/ext/pgsql/tests/80_bug42783.phpt @@ -4,27 +4,35 @@ Bug #42783 (pg_insert() does not support an empty value array) pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECTF-- array(2) { ["id"]=> diff --git a/ext/pgsql/tests/98old_api.phpt b/ext/pgsql/tests/98old_api.phpt index 029303de6addd..26bfd6fa5966a 100644 --- a/ext/pgsql/tests/98old_api.phpt +++ b/ext/pgsql/tests/98old_api.phpt @@ -3,13 +3,17 @@ PostgreSQL old api --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECTF-- Deprecated: Function pg_numrows() is deprecated in %s on line %d diff --git a/ext/pgsql/tests/9999dropdb.phpt b/ext/pgsql/tests/9999dropdb.phpt index 80756d9b6e6bd..b8c7d84beb0dd 100644 --- a/ext/pgsql/tests/9999dropdb.phpt +++ b/ext/pgsql/tests/9999dropdb.phpt @@ -3,20 +3,41 @@ PostgreSQL drop db --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- OK diff --git a/ext/pgsql/tests/bug37100.phpt b/ext/pgsql/tests/bug37100.phpt index 50557d8ef8e29..e67fb77bc3317 100644 --- a/ext/pgsql/tests/bug37100.phpt +++ b/ext/pgsql/tests/bug37100.phpt @@ -4,29 +4,28 @@ Bug #37100 (data is returned truncated with BINARY CURSOR) pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- string(24) "\001\003\252\000\010\022" diff --git a/ext/pgsql/tests/bug37100_9.phpt b/ext/pgsql/tests/bug37100_9.phpt index ed0c5ad8ab53d..22db1256d0201 100644 --- a/ext/pgsql/tests/bug37100_9.phpt +++ b/ext/pgsql/tests/bug37100_9.phpt @@ -4,28 +4,27 @@ Bug #37100 (data is returned truncated with BINARY CURSOR) (9.0+) pgsql --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- string(14) "\x0103aa000812" diff --git a/ext/pgsql/tests/bug46408.phpt b/ext/pgsql/tests/bug46408.phpt index 2a9ffeca4d697..f069383c66b4e 100644 --- a/ext/pgsql/tests/bug46408.phpt +++ b/ext/pgsql/tests/bug46408.phpt @@ -4,7 +4,7 @@ Bug #46408 (Locale number format settings can cause pg_query_params to break wit pgsql --SKIPIF-- --FILE-- null, 'not_null_field' => 1)); @@ -31,11 +30,18 @@ echo $query, "\n"; var_dump(pg_fetch_all(pg_query($dbh, 'SELECT * FROM '. $tbl_name))); -@pg_query($dbh, "DROP TABLE $tbl_name"); pg_close($dbh); echo PHP_EOL."Done".PHP_EOL; +?> +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/bug60244.phpt b/ext/pgsql/tests/bug60244.phpt index 50a9d7a831dd9..e162be644af5b 100644 --- a/ext/pgsql/tests/bug60244.phpt +++ b/ext/pgsql/tests/bug60244.phpt @@ -4,15 +4,15 @@ Bug #60244 (pg_fetch_* functions do not validate that row param is >0) pgsql --SKIPIF-- --FILE-- --FILE-- 'ok'); -$converted = pg_convert($db, 'test_enum', $fields); +$converted = pg_convert($db, $table_name, $fields); pg_query($db, "ROLLBACK"); diff --git a/ext/pgsql/tests/bug65119.phpt b/ext/pgsql/tests/bug65119.phpt index f2e46ca137ddd..64b60d34684cc 100644 --- a/ext/pgsql/tests/bug65119.phpt +++ b/ext/pgsql/tests/bug65119.phpt @@ -4,18 +4,20 @@ Bug #65119 (pg_copy_from() modifies input array variable) pgsql --SKIPIF-- --FILE-- + --FILE-- +--CLEAN-- + --EXPECT-- string(52) "UPDATE "test_68638" SET "value"=E'inf' WHERE "id"=1;" diff --git a/ext/pgsql/tests/bug71062.phpt b/ext/pgsql/tests/bug71062.phpt index aabcefb253db6..d05f8c88a237f 100644 --- a/ext/pgsql/tests/bug71062.phpt +++ b/ext/pgsql/tests/bug71062.phpt @@ -3,11 +3,11 @@ Bug #71062 pg_convert() doesn't accept ISO 8601 for datatype timestamp --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- $date_string_modified_iso8601]); print "done\n"; -pg_query($db, "DROP TABLE $table"); - ?> ==OK== +--CLEAN-- + --EXPECT-- trying format Y-m-d\TH:i:sO trying format Y-m-d H:i:sO diff --git a/ext/pgsql/tests/bug71998.phpt b/ext/pgsql/tests/bug71998.phpt index 96fc58ff8272e..e54215dadcd75 100644 --- a/ext/pgsql/tests/bug71998.phpt +++ b/ext/pgsql/tests/bug71998.phpt @@ -3,17 +3,18 @@ Bug #71998 Function pg_insert does not insert when column type = inet --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- ++$i, "remote_addr" => $ip); $r = true; try { - @pg_insert($db, 'tmp_statistics', $data); + @pg_insert($db, $table_name, $data); } catch (\ValueError $e) { echo $e->getMessage() . PHP_EOL; $r = false; @@ -70,19 +71,27 @@ foreach ($ips as $ip) { //echo pg_last_error($db); } - //pg_query($db, "INSERT INTO tmp_statistics (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted + //pg_query($db, "INSERT INTO {$table_name} (id, remote_addr) VALUES (2, '127.0.0.1')"); // OK, record inserted } -$r = pg_query($db, "SELECT * FROM tmp_statistics"); +$r = pg_query($db, "SELECT * FROM {$table_name}"); while (false != ($row = pg_fetch_row($r))) { var_dump($row); } echo $errors, " errors caught\n"; -pg_query($db, "DROP TABLE tmp_statistics"); pg_close($db); +?> +--CLEAN-- + --EXPECT-- pg_insert(): Field "remote_addr" must be a valid IPv4 or IPv6 address string, "256.257.258.259" given diff --git a/ext/pgsql/tests/bug72028.phpt b/ext/pgsql/tests/bug72028.phpt index 9829cb1445098..5c0c0f443f3d3 100644 --- a/ext/pgsql/tests/bug72028.phpt +++ b/ext/pgsql/tests/bug72028.phpt @@ -3,16 +3,16 @@ Bug #72028 pg_query_params(): NULL converts to empty string --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/bug72195.phpt b/ext/pgsql/tests/bug72195.phpt index 560aaf458cfae..2c2004b21323e 100644 --- a/ext/pgsql/tests/bug72195.phpt +++ b/ext/pgsql/tests/bug72195.phpt @@ -3,7 +3,7 @@ Bug #72195 (pg_pconnect/pg_connect cause use-after-free) --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- + --FILE-- --FILE-- "13:31")); + pg_insert($db, $table_name, array("t" => "13:31")); } catch (\TypeError $e) { echo $e->getMessage(); } -pg_insert($db, "bug77047", array("t" => "13:31:13")); -pg_insert($db, "bug77047", array("t" => "1:2:3")); +pg_insert($db, $table_name, array("t" => "13:31:13")); +pg_insert($db, $table_name, array("t" => "1:2:3")); try { - pg_insert($db, "bug77047", array("t" => "xyz")); + pg_insert($db, $table_name, array("t" => "xyz")); } catch (\TypeError $e) { echo $e->getMessage() . PHP_EOL; } -pg_insert($db, "bug77047", array("t" => NULL)); -pg_insert($db, "bug77047", array("t" => "")); +pg_insert($db, $table_name, array("t" => NULL)); +pg_insert($db, $table_name, array("t" => "")); -$res = pg_query($db, "SELECT t FROM bug77047"); +$res = pg_query($db, "SELECT t FROM {$table_name}"); while (false !== ($row = pg_fetch_row($res))) { var_dump(array_pop($row)); } +?> +--CLEAN-- + --EXPECTF-- pg_insert(): Field "t" must be of type string|null, time given diff --git a/ext/pgsql/tests/bug81720.phpt b/ext/pgsql/tests/bug81720.phpt index defae96790caa..1fa8de1ab14cd 100644 --- a/ext/pgsql/tests/bug81720.phpt +++ b/ext/pgsql/tests/bug81720.phpt @@ -3,10 +3,10 @@ Bug #81720 (Uninitialized array in pg_query_params() leading to RCE) --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- diff --git a/ext/pgsql/tests/connect_after_close.phpt b/ext/pgsql/tests/connect_after_close.phpt index 1f450a88e0d13..23924ec1cbe8c 100644 --- a/ext/pgsql/tests/connect_after_close.phpt +++ b/ext/pgsql/tests/connect_after_close.phpt @@ -3,10 +3,10 @@ Reopen connection after it was closed --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- + --FILE-- --FILE-- +--CLEAN-- + --EXPECT-- The large object has been opened successfully. diff --git a/ext/pgsql/tests/gh8253.phpt b/ext/pgsql/tests/gh8253.phpt index b8732fd0d8d52..0f48ddcb83bfa 100644 --- a/ext/pgsql/tests/gh8253.phpt +++ b/ext/pgsql/tests/gh8253.phpt @@ -4,23 +4,31 @@ pg_insert() fails for references pgsql --SKIPIF-- --FILE-- "testing"]; fee($a["bar"]); $db = pg_connect($conn_str); -pg_query($db, "DROP TABLE IF EXISTS gh8253"); -pg_query($db, "CREATE TABLE gh8253 (bar text);"); -pg_insert($db, "gh8253", $a); -$res = pg_query($db, "SELECT * FROM gh8253"); +pg_query($db, "CREATE TABLE {$table_name} (bar text);"); +pg_insert($db, $table_name, $a); +$res = pg_query($db, "SELECT * FROM {$table_name}"); var_dump(pg_fetch_all($res)); ?> +--CLEAN-- + --EXPECT-- array(1) { [0]=> diff --git a/ext/pgsql/tests/inc/config.inc b/ext/pgsql/tests/inc/config.inc new file mode 100644 index 0000000000000..b01b120723d9f --- /dev/null +++ b/ext/pgsql/tests/inc/config.inc @@ -0,0 +1,9 @@ + diff --git a/ext/pgsql/tests/lcmess.inc b/ext/pgsql/tests/inc/lcmess.inc similarity index 100% rename from ext/pgsql/tests/lcmess.inc rename to ext/pgsql/tests/inc/lcmess.inc diff --git a/ext/pgsql/tests/nonblocking.inc b/ext/pgsql/tests/inc/nonblocking.inc similarity index 100% rename from ext/pgsql/tests/nonblocking.inc rename to ext/pgsql/tests/inc/nonblocking.inc diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/inc/skipif.inc similarity index 100% rename from ext/pgsql/tests/skipif.inc rename to ext/pgsql/tests/inc/skipif.inc diff --git a/ext/pgsql/tests/pg_delete_001.phpt b/ext/pgsql/tests/pg_delete_001.phpt index abf01a6b53f6d..726f08f0881c1 100644 --- a/ext/pgsql/tests/pg_delete_001.phpt +++ b/ext/pgsql/tests/pg_delete_001.phpt @@ -3,52 +3,62 @@ PostgreSQL pg_delete() - basic test using schema --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- 1, 'id2' => 1)); -pg_insert($conn, 'foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'foo', array('id' => 3, 'id2' => 3)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 3, 'id2' => 3)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); -pg_insert($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); -pg_insert($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 1)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); -pg_delete($conn, 'foo', array('id' => 1, 'id2' => 0)); -pg_delete($conn, 'foo', array('id' => 1, 'id2' => 2)); -var_dump(pg_delete($conn, 'foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); +pg_delete($conn, $table_name, array('id' => 1, 'id2' => 0)); +pg_delete($conn, $table_name, array('id' => 1, 'id2' => 2)); +var_dump(pg_delete($conn, $table_name, array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); -pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 1)); -pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 3)); -var_dump(pg_delete($conn, 'phptests.foo', array('id' => 2, 'id2' => 3), PGSQL_DML_STRING)); +pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 1)); +pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3)); +var_dump(pg_delete($conn, "{$schema_name}.{$table_name}", array('id' => 2, 'id2' => 3), PGSQL_DML_STRING)); -var_dump(pg_fetch_all(pg_query($conn, 'SELECT * FROM foo'))); -var_dump(pg_fetch_all(pg_query($conn, 'SELECT * FROM phptests.foo'))); +var_dump(pg_fetch_all(pg_query($conn, "SELECT * FROM {$table_name}"))); +var_dump(pg_fetch_all(pg_query($conn, "SELECT * FROM {$schema_name}.{$table_name}"))); /* Inexistent */ pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2)); var_dump(pg_delete($conn, 'bar', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); -pg_query($conn, 'DROP TABLE foo'); -pg_query($conn, 'DROP TABLE phptests.foo'); -pg_query($conn, 'DROP SCHEMA phptests'); +?> +--CLEAN-- + --EXPECTF-- -string(43) "DELETE FROM "foo" WHERE "id"=1 AND "id2"=2;" -string(54) "DELETE FROM "phptests"."foo" WHERE "id"=2 AND "id2"=3;" +string(59) "DELETE FROM "table_pg_delete_001" WHERE "id"=1 AND "id2"=2;" +string(82) "DELETE FROM "schema_pg_delete_001"."table_pg_delete_001" WHERE "id"=2 AND "id2"=3;" array(2) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_insert_001.phpt b/ext/pgsql/tests/pg_insert_001.phpt index b3e934692cf24..89f995acc2dd0 100644 --- a/ext/pgsql/tests/pg_insert_001.phpt +++ b/ext/pgsql/tests/pg_insert_001.phpt @@ -3,33 +3,42 @@ PostgreSQL pg_select() - basic test using schema --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- 1, 'id2' => 1)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); -var_dump(pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); +var_dump(pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2), PGSQL_DML_STRING)); -var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.{$table_name}", array('id' => 1))); -pg_query($conn, 'DROP TABLE phptests.foo'); -pg_query($conn, 'DROP SCHEMA phptests'); +?> +--CLEAN-- + --EXPECTF-- -Warning: pg_insert(): Table 'foo' doesn't exists in %s on line %d -string(55) "INSERT INTO "phptests"."foo" ("id","id2") VALUES (1,2);" +Warning: pg_insert(): Table 'table_pg_insert_001' doesn't exists in %s on line %d +string(83) "INSERT INTO "schema_pg_insert_001"."table_pg_insert_001" ("id","id2") VALUES (1,2);" array(1) { [0]=> array(2) { diff --git a/ext/pgsql/tests/pg_insert_002.phpt b/ext/pgsql/tests/pg_insert_002.phpt index 19537e8a5d5d1..533b1762706cf 100644 --- a/ext/pgsql/tests/pg_insert_002.phpt +++ b/ext/pgsql/tests/pg_insert_002.phpt @@ -3,11 +3,11 @@ PostgreSQL pg_insert() - test for CVE-2015-1532 --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- + --FILE-- +--CLEAN-- + --EXPECT-- array(2) { diff --git a/ext/pgsql/tests/pg_pipeline_sync.phpt b/ext/pgsql/tests/pg_pipeline_sync.phpt index 38366a025483b..96dc7e613f9b8 100644 --- a/ext/pgsql/tests/pg_pipeline_sync.phpt +++ b/ext/pgsql/tests/pg_pipeline_sync.phpt @@ -4,7 +4,7 @@ PostgreSQL pipeline mode pgsql --SKIPIF-- + --FILE-- 1))); /* Existent column */ -var_dump(pg_select($conn, 'phptests.foo', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.foo", array('id' => 1))); /* Testing with inexistent column */ -var_dump(pg_select($conn, 'phptests.bar', array('id' => 1))); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id' => 1))); /* Existent column */ -var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4))); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id4' => 4))); /* Use a different result type */ -var_dump(pg_select($conn, 'phptests.bar', array('id4' => 4), 0, PGSQL_NUM)); +var_dump(pg_select($conn, "{$schema_name}.bar", array('id4' => 4), 0, PGSQL_NUM)); /* Empty array */ -var_dump(pg_select($conn, 'phptests.bar', array())); +var_dump(pg_select($conn, "{$schema_name}.bar", array())); /* No array */ -var_dump(pg_select($conn, 'phptests.bar')); +var_dump(pg_select($conn, "{$schema_name}.bar")); -pg_query($conn, 'DROP TABLE phptests.foo'); -pg_query($conn, 'DROP TABLE phptests.bar'); -pg_query($conn, 'DROP SCHEMA phptests'); +?> +--CLEAN-- + --EXPECTF-- Warning: pg_select(): Table 'foo' doesn't exists in %s on line %d diff --git a/ext/pgsql/tests/pg_trace.phpt b/ext/pgsql/tests/pg_trace.phpt index 16e483cc99213..9caf1d2ed935d 100644 --- a/ext/pgsql/tests/pg_trace.phpt +++ b/ext/pgsql/tests/pg_trace.phpt @@ -3,11 +3,11 @@ pg_trace --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- getMessage() . PHP_EOL; } var_dump(pg_trace($tracefile, 'w', $db, 0)); -$res = pg_query($db, 'select 1'); +$res = pg_query($db, 'SELECT 1'); ?> --EXPECTF-- diff --git a/ext/pgsql/tests/pg_update_001.phpt b/ext/pgsql/tests/pg_update_001.phpt index eb3958a23135a..df03cce7efaf7 100644 --- a/ext/pgsql/tests/pg_update_001.phpt +++ b/ext/pgsql/tests/pg_update_001.phpt @@ -3,42 +3,52 @@ PostgreSQL pg_update() - basic test using schema --EXTENSIONS-- pgsql --SKIPIF-- - + --FILE-- 1, 'id2' => 1)); -pg_insert($conn, 'phptests.foo', array('id' => 1, 'id2' => 2)); +pg_insert($conn, $table_name, array('id' => 1, 'id2' => 1)); +pg_insert($conn, "{$schema_name}.{$table_name}", array('id' => 1, 'id2' => 2)); -pg_update($conn, 'foo', array('id' => 10), array('id' => 1)); -var_dump(pg_update($conn, 'foo', array('id' => 10), array('id' => 1), PGSQL_DML_STRING)); +pg_update($conn, $table_name, array('id' => 10), array('id' => 1)); +var_dump(pg_update($conn, $table_name, array('id' => 10), array('id' => 1), PGSQL_DML_STRING)); -pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2)); -var_dump(pg_update($conn, 'phptests.foo', array('id' => 100), array('id2' => 2), PGSQL_DML_STRING)); +pg_update($conn, "{$schema_name}.{$table_name}", array('id' => 100), array('id2' => 2)); +var_dump(pg_update($conn, "{$schema_name}.{$table_name}", array('id' => 100), array('id2' => 2), PGSQL_DML_STRING)); -$rs = pg_query($conn, 'SELECT * FROM foo UNION SELECT * FROM phptests.foo ORDER BY id'); +$rs = pg_query($conn, "SELECT * FROM {$table_name} UNION SELECT * FROM {$schema_name}.{$table_name} ORDER BY id"); while ($row = pg_fetch_assoc($rs)) { var_dump($row); } -pg_query($conn, 'DROP TABLE foo'); -pg_query($conn, 'DROP TABLE phptests.foo'); -pg_query($conn, 'DROP SCHEMA phptests'); +?> +--CLEAN-- + --EXPECT-- -string(38) "UPDATE "foo" SET "id"=10 WHERE "id"=1;" -string(51) "UPDATE "phptests"."foo" SET "id"=100 WHERE "id2"=2;" +string(54) "UPDATE "table_pg_update_001" SET "id"=10 WHERE "id"=1;" +string(79) "UPDATE "schema_pg_update_001"."table_pg_update_001" SET "id"=100 WHERE "id2"=2;" array(2) { ["id"]=> string(2) "10"