diff options
Diffstat (limited to 'ext/pdo_pgsql')
47 files changed, 332 insertions, 313 deletions
diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4 index ca6320ef35..7655357de4 100644 --- a/ext/pdo_pgsql/config.m4 +++ b/ext/pdo_pgsql/config.m4 @@ -1,9 +1,8 @@ -dnl config.m4 for extension pdo_pgsql -dnl vim:et:sw=2:ts=2: - -PHP_ARG_WITH(pdo-pgsql,for PostgreSQL support for PDO, -[ --with-pdo-pgsql[=DIR] PDO: PostgreSQL support. DIR is the PostgreSQL base - install directory or the path to pg_config]) +PHP_ARG_WITH([pdo-pgsql], + [for PostgreSQL support for PDO], + [AS_HELP_STRING([[--with-pdo-pgsql[=DIR]]], + [PDO: PostgreSQL support. DIR is the PostgreSQL base install directory or + the path to pg_config])]) if test "$PHP_PDO_PGSQL" != "no"; then @@ -67,19 +66,6 @@ if test "$PHP_PDO_PGSQL" != "no"; then AC_DEFINE(HAVE_PDO_PGSQL,1,[Whether to build PostgreSQL for PDO support or not]) - AC_MSG_CHECKING([for openssl dependencies]) - grep openssl $PGSQL_INCLUDE/libpq-fe.h >/dev/null 2>&1 - if test $? -eq 0 ; then - AC_MSG_RESULT([yes]) - dnl First try to find pkg-config - AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists openssl; then - PDO_PGSQL_CFLAGS=`$PKG_CONFIG openssl --cflags` - fi - else - AC_MSG_RESULT([no]) - fi - old_LIBS=$LIBS old_LDFLAGS=$LDFLAGS LDFLAGS="-L$PGSQL_LIBDIR $LDFLAGS" @@ -97,26 +83,8 @@ if test "$PHP_PDO_PGSQL" != "no"; then PHP_ADD_INCLUDE($PGSQL_INCLUDE) - ifdef([PHP_CHECK_PDO_INCLUDES], - [ - PHP_CHECK_PDO_INCLUDES - ],[ - AC_MSG_CHECKING([for PDO includes]) - if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then - pdo_cv_inc_path=$abs_srcdir/ext - elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then - pdo_cv_inc_path=$abs_srcdir/ext - elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then - pdo_cv_inc_path=$phpincludedir/ext - else - AC_MSG_ERROR([Cannot find php_pdo_driver.h.]) - fi - AC_MSG_RESULT($pdo_cv_inc_path) - ]) - - PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_PGSQL_CFLAGS) - ifdef([PHP_ADD_EXTENSION_DEP], - [ - PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) - ]) + PHP_CHECK_PDO_INCLUDES + + PHP_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared,,-I$pdo_cv_inc_path) + PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) fi diff --git a/ext/pdo_pgsql/config.w32 b/ext/pdo_pgsql/config.w32 index 47a8a0ecd9..12ba8b7a07 100644 --- a/ext/pdo_pgsql/config.w32 +++ b/ext/pdo_pgsql/config.w32 @@ -7,7 +7,7 @@ if (PHP_PDO_PGSQL != "no") { CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PDO_PGSQL", PHP_PDO_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;")) { EXTENSION("pdo_pgsql", "pdo_pgsql.c pgsql_driver.c pgsql_statement.c"); - if (CHECK_HEADER_ADD_INCLUDE("pg_config.h", "CFLAGS_PDO_PGSQL", PHP_PDO_PGSQL + ";" + PHP_PHP_BUILD + "\\include\\pgsql")) { + if (CHECK_HEADER_ADD_INCLUDE("pg_config.h", "CFLAGS_PDO_PGSQL", PHP_PDO_PGSQL + ";" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;")) { ADD_FLAG('CFLAGS_PDO_PGSQL', "/D HAVE_PG_CONFIG_H"); } if (X64) { diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c index 0996b34c32..8d60fe420b 100644 --- a/ext/pdo_pgsql/pdo_pgsql.c +++ b/ext/pdo_pgsql/pdo_pgsql.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -29,11 +29,6 @@ #include "php_pdo_pgsql_int.h" #ifdef HAVE_PG_CONFIG_H -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION #include <pg_config.h> #endif @@ -110,12 +105,3 @@ PHP_MINFO_FUNCTION(pdo_pgsql) php_info_print_table_end(); } /* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 1be0a6146e..a32d52c6a4 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -31,12 +31,6 @@ #include "pdo/php_pdo_driver.h" #include "pdo/php_pdo_error.h" #include "ext/standard/file.h" - -#undef PACKAGE_BUGREPORT -#undef PACKAGE_NAME -#undef PACKAGE_STRING -#undef PACKAGE_TARNAME -#undef PACKAGE_VERSION #include "pg_config.h" /* needed for PG_VERSION */ #include "php_pdo_pgsql.h" #include "php_pdo_pgsql_int.h" @@ -130,13 +124,13 @@ static int pdo_pgsql_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *in /* }}} */ /* {{{ pdo_pgsql_create_lob_stream */ -static size_t pgsql_lob_write(php_stream *stream, const char *buf, size_t count) +static ssize_t pgsql_lob_write(php_stream *stream, const char *buf, size_t count) { struct pdo_pgsql_lob_self *self = (struct pdo_pgsql_lob_self*)stream->abstract; return lo_write(self->conn, self->lfd, (char*)buf, count); } -static size_t pgsql_lob_read(php_stream *stream, char *buf, size_t count) +static ssize_t pgsql_lob_read(php_stream *stream, char *buf, size_t count) { struct pdo_pgsql_lob_self *self = (struct pdo_pgsql_lob_self*)stream->abstract; return lo_read(self->conn, self->lfd, buf, count); @@ -262,36 +256,36 @@ static int pgsql_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_len execute_only = H->disable_prepares; } - if (!emulate && PQprotocolVersion(H->server) > 2) { + if (!emulate && PQprotocolVersion(H->server) <= 2) { + emulate = 1; + } + + if (emulate) { + stmt->supports_placeholders = PDO_PLACEHOLDER_NONE; + } else { stmt->supports_placeholders = PDO_PLACEHOLDER_NAMED; stmt->named_rewrite_template = "$%d"; - ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len); - - if (ret == 1) { - /* query was re-written */ - sql = nsql; - } else if (ret == -1) { - /* couldn't grok it */ - strcpy(dbh->error_code, stmt->error_code); - return 0; - } + } - if (!execute_only) { - /* prepared query: set the query name and defer the - actual prepare until the first execute call */ - spprintf(&S->stmt_name, 0, "pdo_stmt_%08x", ++H->stmt_counter); - } + ret = pdo_parse_params(stmt, (char*)sql, sql_len, &nsql, &nsql_len); - if (nsql) { - S->query = nsql; - } else { - S->query = estrdup(sql); - } + if (ret == -1) { + /* couldn't grok it */ + strcpy(dbh->error_code, stmt->error_code); + return 0; + } else if (ret == 1) { + /* query was re-written */ + S->query = nsql; + } else { + S->query = estrdup(sql); + } - return 1; + if (!emulate && !execute_only) { + /* prepared query: set the query name and defer the + actual prepare until the first execute call */ + spprintf(&S->stmt_name, 0, "pdo_stmt_%08x", ++H->stmt_counter); } - stmt->supports_placeholders = PDO_PLACEHOLDER_NONE; return 1; } @@ -562,7 +556,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) RETURN_FALSE; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -598,7 +592,10 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray) PQclear(pgsql_result); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(pg_rows), tmp) { size_t query_len; - convert_to_string_ex(tmp); + if (!try_convert_to_string(tmp)) { + efree(query); + return; + } if (buffer_len < Z_STRLEN_P(tmp)) { buffer_len = Z_STRLEN_P(tmp); @@ -667,7 +664,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile) } /* Obtain db Handler */ - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -767,7 +764,7 @@ static PHP_METHOD(PDO, pgsqlCopyToFile) return; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -860,7 +857,7 @@ static PHP_METHOD(PDO, pgsqlCopyToArray) return; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -925,7 +922,7 @@ static PHP_METHOD(PDO, pgsqlLOBCreate) pdo_pgsql_db_handle *H; Oid lfd; - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -973,7 +970,7 @@ static PHP_METHOD(PDO, pgsqlLOBOpen) mode = INV_READ|INV_WRITE; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -982,7 +979,7 @@ static PHP_METHOD(PDO, pgsqlLOBOpen) lfd = lo_open(H->server, oid, mode); if (lfd >= 0) { - php_stream *stream = pdo_pgsql_create_lob_stream(getThis(), lfd, oid); + php_stream *stream = pdo_pgsql_create_lob_stream(ZEND_THIS, lfd, oid); if (stream) { php_stream_to_zval(stream, return_value); return; @@ -1016,7 +1013,7 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink) RETURN_FALSE; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; PDO_DBH_CLEAR_ERR(); @@ -1047,7 +1044,7 @@ static PHP_METHOD(PDO, pgsqlGetNotify) RETURN_FALSE; } - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; if (result_type == PDO_FETCH_USE_DEFAULT) { @@ -1120,7 +1117,7 @@ static PHP_METHOD(PDO, pgsqlGetPid) pdo_dbh_t *dbh; pdo_pgsql_db_handle *H; - dbh = Z_PDO_DBH_P(getThis()); + dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; H = (pdo_pgsql_db_handle *)dbh->driver_data; @@ -1271,12 +1268,3 @@ const pdo_driver_t pdo_pgsql_driver = { PDO_DRIVER_HEADER(pgsql), pdo_pgsql_handle_factory }; - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 86cb084a1d..d830d57c18 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -149,7 +149,7 @@ static int pgsql_stmt_execute(pdo_stmt_t *stmt) if (S->is_prepared) { spprintf(&q, 0, "CLOSE %s", S->cursor_name); - S->result = PQexec(H->server, q); + PQclear(PQexec(H->server, q)); efree(q); } @@ -526,7 +526,7 @@ static int pgsql_stmt_describe(pdo_stmt_t *stmt, int colno) return 1; } -static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulong *len, int *caller_frees ) +static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, size_t *len, int *caller_frees ) { pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt->driver_data; struct pdo_column_data *cols = stmt->columns; @@ -553,7 +553,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, zend_ulon break; case PDO_PARAM_BOOL: - S->cols[colno].boolval = **ptr == 't' ? 1: 0; + S->cols[colno].boolval = **ptr == 't'; *ptr = (char *) &(S->cols[colno].boolval); *len = sizeof(zend_bool); break; @@ -727,12 +727,3 @@ const struct pdo_stmt_methods pgsql_stmt_methods = { NULL, /* next_rowset */ pdo_pgsql_stmt_cursor_closer }; - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/pdo_pgsql/php_pdo_pgsql.h b/ext/pdo_pgsql/php_pdo_pgsql.h index 0680cc6d4a..e6d7c17058 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql.h +++ b/ext/pdo_pgsql/php_pdo_pgsql.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -36,13 +36,3 @@ PHP_MSHUTDOWN_FUNCTION(pdo_pgsql); PHP_MINFO_FUNCTION(pdo_pgsql); #endif /* PHP_PDO_PGSQL_H */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/pdo_pgsql/php_pdo_pgsql_int.h b/ext/pdo_pgsql/php_pdo_pgsql_int.h index 7351a8b77e..9b1f60549f 100644 --- a/ext/pdo_pgsql/php_pdo_pgsql_int.h +++ b/ext/pdo_pgsql/php_pdo_pgsql_int.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2018 The PHP Group | + | Copyright (c) The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -110,12 +110,3 @@ php_stream *pdo_pgsql_create_lob_stream(zval *pdh, int lfd, Oid oid); extern const php_stream_ops pdo_pgsql_lob_stream_ops; #endif /* PHP_PDO_PGSQL_INT_H */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ diff --git a/ext/pdo_pgsql/tests/CONFLICTS b/ext/pdo_pgsql/tests/CONFLICTS new file mode 100644 index 0000000000..7ecf66a952 --- /dev/null +++ b/ext/pdo_pgsql/tests/CONFLICTS @@ -0,0 +1 @@ +pgsql diff --git a/ext/pdo_pgsql/tests/bug36727.phpt b/ext/pdo_pgsql/tests/bug36727.phpt index d5f8e49f96..e6b5ab7f28 100644 --- a/ext/pdo_pgsql/tests/bug36727.phpt +++ b/ext/pdo_pgsql/tests/bug36727.phpt @@ -3,15 +3,15 @@ Bug #36727 (segfault in bindValue() when no parameters are defined) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require dirname(__FILE__) . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require dirname(__FILE__) . '/config.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $stmt = $db->prepare('SELECT * FROM child'); var_dump($stmt->bindValue(':test', 1, PDO::PARAM_INT)); diff --git a/ext/pdo_pgsql/tests/bug43925.phpt b/ext/pdo_pgsql/tests/bug43925.phpt index e531a2f7d4..d90f36fbbc 100644 --- a/ext/pdo_pgsql/tests/bug43925.phpt +++ b/ext/pdo_pgsql/tests/bug43925.phpt @@ -3,14 +3,14 @@ Bug #43925 (Incorrect argument counter in prepared statements with pgsql) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$dbh = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$dbh = PDOTest::test_factory(__DIR__ . '/common.phpt'); @$dbh->query('DROP TABLE nodes'); @@ -31,10 +31,10 @@ $dbh->query('INSERT INTO nodes (id, root, lft, rgt) VALUES (3, 1, 4, 5);'); $stmt = $dbh->prepare(' SELECT * FROM nodes - WHERE (:rootId > 0 OR lft > :left OR rgt > :left) + WHERE (:rootId > 0 OR lft > :left OR rgt > :left) AND (root = :rootId OR root = :left) - AND (1 > :left OR 1 < :left OR 1 = :left) - AND (:x > 0 OR :x < 10 OR :x > 100) + AND (1 > :left OR 1 < :left OR 1 = :left) + AND (:x > 0 OR :x < 10 OR :x > 100) OR :y = 1 OR :left = 1 '); diff --git a/ext/pdo_pgsql/tests/bug46274.phpt b/ext/pdo_pgsql/tests/bug46274.phpt index 92ac6a668e..0ae6849b41 100644 --- a/ext/pdo_pgsql/tests/bug46274.phpt +++ b/ext/pdo_pgsql/tests/bug46274.phpt @@ -3,14 +3,14 @@ Bug #46274 (pdo_pgsql - Segfault when using PDO::ATTR_STRINGIFY_FETCHES and blob --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); diff --git a/ext/pdo_pgsql/tests/bug46274_2.phpt b/ext/pdo_pgsql/tests/bug46274_2.phpt index df60f34540..54a32f82e3 100644 --- a/ext/pdo_pgsql/tests/bug46274_2.phpt +++ b/ext/pdo_pgsql/tests/bug46274_2.phpt @@ -3,14 +3,14 @@ Bug #46274 (pdo_pgsql - Segfault when using PDO::ATTR_STRINGIFY_FETCHES and blob --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); diff --git a/ext/pdo_pgsql/tests/bug48764.phpt b/ext/pdo_pgsql/tests/bug48764.phpt index cfe29cd7c3..1f890267e5 100644 --- a/ext/pdo_pgsql/tests/bug48764.phpt +++ b/ext/pdo_pgsql/tests/bug48764.phpt @@ -3,8 +3,8 @@ Bug #48764 (PDO_pgsql::query always uses implicit prepared statements if v3 prot --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); $db = PDOTest::factory(); @@ -19,8 +19,8 @@ if (version_compare($server_version, '7.4', '<') || version_compare($client_vers ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Test 1\n"; diff --git a/ext/pdo_pgsql/tests/bug61267.phpt b/ext/pdo_pgsql/tests/bug61267.phpt index f91eceecdf..f1eee993b1 100644 --- a/ext/pdo_pgsql/tests/bug61267.phpt +++ b/ext/pdo_pgsql/tests/bug61267.phpt @@ -3,15 +3,15 @@ PDO::exec() returns 0 when the statement is a SELECT. --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require_once dirname(__FILE__) . '/config.inc'; +require_once __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once __DIR__ . '/config.inc'; PDOTest::skip(); ?> --FILE-- <?php -require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require_once dirname(__FILE__) . '/config.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require_once __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once __DIR__ . '/config.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $res = $db->exec('SELECT * from generate_series(1, 42);'); var_dump($res); diff --git a/ext/pdo_pgsql/tests/bug62479.phpt b/ext/pdo_pgsql/tests/bug62479.phpt index 389240f8e1..3e78098d0c 100644 --- a/ext/pdo_pgsql/tests/bug62479.phpt +++ b/ext/pdo_pgsql/tests/bug62479.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #62479 (PDO-psql cannot connect if password contains spaces) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); $dsn = getenv('PDOTEST_DSN'); if (empty($dsn)) die('skip no dsn found in env'); -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -37,9 +37,9 @@ $db->exec("DROP USER $user"); ?> --FILE-- <?php -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $rand = rand(5, 400); $user = "pdo_test_$rand"; diff --git a/ext/pdo_pgsql/tests/bug62498-32bit.phpt b/ext/pdo_pgsql/tests/bug62498-32bit.phpt index edcf52048c..dc5622e68b 100644 --- a/ext/pdo_pgsql/tests/bug62498-32bit.phpt +++ b/ext/pdo_pgsql/tests/bug62498-32bit.phpt @@ -3,8 +3,8 @@ PDO PgSQL Bug #62498 (pdo_pgsql inefficient when getColumnMeta() is used), 32-bi --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); if (PHP_INT_SIZE > 4) die("skip relevant for 32-bit only"); ?> @@ -12,8 +12,8 @@ if (PHP_INT_SIZE > 4) die("skip relevant for 32-bit only"); <?php echo "Begin test...\n"; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // create the table diff --git a/ext/pdo_pgsql/tests/bug62498.phpt b/ext/pdo_pgsql/tests/bug62498.phpt index 53d42fc3fa..1620e7e77a 100644 --- a/ext/pdo_pgsql/tests/bug62498.phpt +++ b/ext/pdo_pgsql/tests/bug62498.phpt @@ -3,8 +3,8 @@ PDO PgSQL Bug #62498 (pdo_pgsql inefficient when getColumnMeta() is used), 64-bi --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); if (PHP_INT_SIZE < 8) die("skip valid for 64-bit only"); ?> @@ -12,8 +12,8 @@ if (PHP_INT_SIZE < 8) die("skip valid for 64-bit only"); <?php echo "Begin test...\n"; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); // create the table diff --git a/ext/pdo_pgsql/tests/bug62593.phpt b/ext/pdo_pgsql/tests/bug62593.phpt index 1b5b3c05aa..598307a652 100644 --- a/ext/pdo_pgsql/tests/bug62593.phpt +++ b/ext/pdo_pgsql/tests/bug62593.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #62593 (Emulate prepares behave strangely with PARAM_BOOL) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); $errors = array(); diff --git a/ext/pdo_pgsql/tests/bug64953.phpt b/ext/pdo_pgsql/tests/bug64953.phpt index 6e72bcab68..f0c57a3e57 100644 --- a/ext/pdo_pgsql/tests/bug64953.phpt +++ b/ext/pdo_pgsql/tests/bug64953.phpt @@ -3,16 +3,16 @@ PDO PgSQL Bug #64953 (Postgres prepared statement positional parameter casting) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php echo "Test\n"; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); echo "Taken from the bug report:\n"; diff --git a/ext/pdo_pgsql/tests/bug66584.phpt b/ext/pdo_pgsql/tests/bug66584.phpt index 1a430f0c13..7c98046a30 100644 --- a/ext/pdo_pgsql/tests/bug66584.phpt +++ b/ext/pdo_pgsql/tests/bug66584.phpt @@ -4,14 +4,14 @@ PDO PgSQL Bug #66584 (Segmentation fault on statement deallocation) <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); if (!extension_loaded('json')) die('skip json ext not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); diff --git a/ext/pdo_pgsql/tests/bug67462.phpt b/ext/pdo_pgsql/tests/bug67462.phpt index 888b19c248..11a39a5f12 100644 --- a/ext/pdo_pgsql/tests/bug67462.phpt +++ b/ext/pdo_pgsql/tests/bug67462.phpt @@ -3,15 +3,15 @@ PDO PgSQL Bug #67462 (PDO_PGSQL::beginTransaction() wrongly throws exception whe --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->beginTransaction(); diff --git a/ext/pdo_pgsql/tests/bug68199.phpt b/ext/pdo_pgsql/tests/bug68199.phpt index 9abfba2b8e..0c79faeeb9 100644 --- a/ext/pdo_pgsql/tests/bug68199.phpt +++ b/ext/pdo_pgsql/tests/bug68199.phpt @@ -1,10 +1,10 @@ --TEST-- Bug #68199 (PDO::pgsqlGetNotify doesn't support NOTIFY payloads) --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); $db = PDOTest::factory(); @@ -15,8 +15,8 @@ if (version_compare($db->getAttribute(PDO::ATTR_SERVER_VERSION), '9.0.0') < 0) { ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // pgsqlGetPid should return something meaningful diff --git a/ext/pdo_pgsql/tests/bug68371.phpt b/ext/pdo_pgsql/tests/bug68371.phpt index 350708b97d..24dc5f501f 100644 --- a/ext/pdo_pgsql/tests/bug68371.phpt +++ b/ext/pdo_pgsql/tests/bug68371.phpt @@ -3,15 +3,15 @@ PDO PgSQL Bug #38671 (PDO#getAttribute() cannot be called with platform-specific --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $attrs = array( diff --git a/ext/pdo_pgsql/tests/bug69344.phpt b/ext/pdo_pgsql/tests/bug69344.phpt index d8e5d25b0a..14d45d0ddb 100644 --- a/ext/pdo_pgsql/tests/bug69344.phpt +++ b/ext/pdo_pgsql/tests/bug69344.phpt @@ -3,15 +3,15 @@ PDO PgSQL Bug #69344 (PDO PgSQL Incorrect binding numeric array with gaps) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $pdo->setAttribute (\PDO::ATTR_DEFAULT_FETCH_MODE, \PDO::FETCH_ASSOC); diff --git a/ext/pdo_pgsql/tests/bug69362.phpt b/ext/pdo_pgsql/tests/bug69362.phpt index 3db58d5fcc..1fd4e80e7d 100644 --- a/ext/pdo_pgsql/tests/bug69362.phpt +++ b/ext/pdo_pgsql/tests/bug69362.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #69362 (PDO-pgsql fails to connect if password contains a leading --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); $dsn = getenv('PDOTEST_DSN'); if (empty($dsn)) die('skip no dsn found in env'); -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -37,9 +37,9 @@ $db->exec("DROP USER $user"); ?> --FILE-- <?php -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $rand = rand(5, 400); $user = "pdo_test_$rand"; diff --git a/ext/pdo_pgsql/tests/bug69752.phpt b/ext/pdo_pgsql/tests/bug69752.phpt index e83855f218..4b6bce9619 100644 --- a/ext/pdo_pgsql/tests/bug69752.phpt +++ b/ext/pdo_pgsql/tests/bug69752.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #69752 (memory leak with closeCursor) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); diff --git a/ext/pdo_pgsql/tests/bug70313.phpt b/ext/pdo_pgsql/tests/bug70313.phpt index 14c3b7bfcc..f734442f8c 100644 --- a/ext/pdo_pgsql/tests/bug70313.phpt +++ b/ext/pdo_pgsql/tests/bug70313.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #70313 (PDO statement fails to throw exception) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); diff --git a/ext/pdo_pgsql/tests/bug70861.phpt b/ext/pdo_pgsql/tests/bug70861.phpt index 7edebba1e6..2da08e6e03 100644 --- a/ext/pdo_pgsql/tests/bug70861.phpt +++ b/ext/pdo_pgsql/tests/bug70861.phpt @@ -3,14 +3,14 @@ Bug #70861 Segmentation fault in pdo_parse_params() during Drupal 8 test suite --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true); diff --git a/ext/pdo_pgsql/tests/bug71573.phpt b/ext/pdo_pgsql/tests/bug71573.phpt index d3046bff6b..66562344ef 100644 --- a/ext/pdo_pgsql/tests/bug71573.phpt +++ b/ext/pdo_pgsql/tests/bug71573.phpt @@ -3,15 +3,15 @@ Bug #71573 (Segfault (core dumped) if paramno beyond bound) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require_once dirname(__FILE__) . '/config.inc'; +require_once __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once __DIR__ . '/config.inc'; PDOTest::skip(); ?> --FILE-- <?php -require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require_once dirname(__FILE__) . '/config.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require_once __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once __DIR__ . '/config.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $statement = $db->prepare('select ?'); $statement->execute([ 'test', 'test', 'test' ]); diff --git a/ext/pdo_pgsql/tests/bug71885.phpt b/ext/pdo_pgsql/tests/bug71885.phpt new file mode 100644 index 0000000000..ea5b1882ff --- /dev/null +++ b/ext/pdo_pgsql/tests/bug71885.phpt @@ -0,0 +1,46 @@ +--TEST-- +Request #71855 (PDO placeholder escaping) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); +require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once dirname(__FILE__) . '/config.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once dirname(__FILE__) . '/config.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); + +foreach ([false, true] as $emulate) { + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); + + try { + $stmt = $db->prepare('select ?- lseg \'((-1,0),(1,0))\''); + $stmt->execute(); + } catch (PDOException $e) { + var_dump('ERR'); + } + + $stmt = $db->prepare('select ??- lseg \'((-1,0),(1,0))\''); + $stmt->execute(); + + var_dump($stmt->fetch()); +} + +?> +==OK== +--EXPECT-- +string(3) "ERR" +array(1) { + [0]=> + bool(true) +} +array(1) { + [0]=> + bool(true) +} +==OK== diff --git a/ext/pdo_pgsql/tests/bug71885_2.phpt b/ext/pdo_pgsql/tests/bug71885_2.phpt new file mode 100644 index 0000000000..f957a39610 --- /dev/null +++ b/ext/pdo_pgsql/tests/bug71885_2.phpt @@ -0,0 +1,58 @@ +--TEST-- +Request #71855 (PDO placeholder escaping, part 2) +--SKIPIF-- +<?php +if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); +if (!extension_loaded('json')) die('skip json extension not available'); +require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once dirname(__FILE__) . '/config.inc'; +PDOTest::skip(); + +$db = PDOTest::factory(); +if (version_compare($db->getAttribute(PDO::ATTR_SERVER_VERSION), '9.4.0') < 0) { + die("skip Requires 9.4+"); +} + +?> +--FILE-- +<?php +require_once dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require_once dirname(__FILE__) . '/config.inc'; +$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); +$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_NUM); + +$jsonb = $db->quote(json_encode(['a' => 1])); + +foreach ([false, true] as $emulate) { + $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, $emulate); + + $stmt = $db->prepare("SELECT {$jsonb}::jsonb ?? ?"); + $stmt->execute(['b']); + var_dump($stmt->fetch()); + + $stmt = $db->prepare("SELECT {$jsonb}::jsonb ???"); + $stmt->execute(['a']); + var_dump($stmt->fetch()); +} + +?> +==OK== +--EXPECT-- +array(1) { + [0]=> + bool(false) +} +array(1) { + [0]=> + bool(true) +} +array(1) { + [0]=> + bool(false) +} +array(1) { + [0]=> + bool(true) +} +==OK== diff --git a/ext/pdo_pgsql/tests/bug72294.phpt b/ext/pdo_pgsql/tests/bug72294.phpt index 46c462417b..bd5124ff17 100644 --- a/ext/pdo_pgsql/tests/bug72294.phpt +++ b/ext/pdo_pgsql/tests/bug72294.phpt @@ -3,13 +3,13 @@ Bug #72294 Segmentation fault/invalid pointer in connection with pgsql_stmt_dtor --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; function handleError($errno, $errstr, $errfile, $errline) { @@ -74,7 +74,7 @@ class PHPUnit_Framework_TestResult $oldErrorHandler = set_error_handler( 'handleError', - E_ALL | E_STRICT + E_ALL ); try { @@ -110,7 +110,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase { public function testIt() { - $pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); + $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $prepared_statement_cache = new PreparedStatementCache( $pdo ); @@ -125,7 +125,7 @@ SQL public function test_construct() { - $pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); + $pdo = PDOTest::test_factory(__DIR__ . '/common.phpt'); $pdo->exec( 'CREATE TEMPORARY TABLE temp_table ( test_column INT NOT NULL );' ); diff --git a/ext/pdo_pgsql/tests/bug72570.phpt b/ext/pdo_pgsql/tests/bug72570.phpt index 76329b1996..b479974484 100644 --- a/ext/pdo_pgsql/tests/bug72570.phpt +++ b/ext/pdo_pgsql/tests/bug72570.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #72570 (Segmentation fault when binding parameters on a query with --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); diff --git a/ext/pdo_pgsql/tests/bug72633.phpt b/ext/pdo_pgsql/tests/bug72633.phpt index 06bd25e626..1c11311fc5 100644 --- a/ext/pdo_pgsql/tests/bug72633.phpt +++ b/ext/pdo_pgsql/tests/bug72633.phpt @@ -3,16 +3,16 @@ PDO PgSQL Bug #72633 (Postgres PDO lastInsertId() should work without specifying --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); diff --git a/ext/pdo_pgsql/tests/bug73959.phpt b/ext/pdo_pgsql/tests/bug73959.phpt index c04b4acd52..7a73632916 100644 --- a/ext/pdo_pgsql/tests/bug73959.phpt +++ b/ext/pdo_pgsql/tests/bug73959.phpt @@ -3,15 +3,15 @@ Bug #73959 (lastInsertId fails to throw an exception) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require dirname(__FILE__) . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -require dirname(__FILE__) . '/config.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_PERSISTENT, false); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::PGSQL_ATTR_DISABLE_PREPARES, true); diff --git a/ext/pdo_pgsql/tests/bug75402.phpt b/ext/pdo_pgsql/tests/bug75402.phpt index 2b6a05fef9..9c7460b871 100644 --- a/ext/pdo_pgsql/tests/bug75402.phpt +++ b/ext/pdo_pgsql/tests/bug75402.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #75402 Possible Memory Leak using PDO::CURSOR_SCROLL option --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $resp = new \stdClass(); $resp->entries = []; @@ -47,15 +47,15 @@ $db->query("INSERT INTO bug75402 (\"id\", \"group_id\", \"submitter\", \"operati $sql = "SELECT - ID as \"sID\", - GROUP_ID as \"sGroupID\", - SUBMITTER as \"sOwner\", - OPERATION as \"sOperation\", - DESCRIPTION as \"sInfo\", - STAGE as \"sShortStatus\", - STATUS as \"sStatus\", - PROGRESS as \"sProgress\", - HIDDEN as \"bHidden\", + ID as \"sID\", + GROUP_ID as \"sGroupID\", + SUBMITTER as \"sOwner\", + OPERATION as \"sOperation\", + DESCRIPTION as \"sInfo\", + STAGE as \"sShortStatus\", + STATUS as \"sStatus\", + PROGRESS as \"sProgress\", + HIDDEN as \"bHidden\", to_char(INSERT_DATETIME, 'IYYY.MM.DD HH24:MI:SS') as \"sDatetime\" FROM bug75402 ORDER BY INSERT_DATETIME DESC"; diff --git a/ext/pdo_pgsql/tests/bug_33876.phpt b/ext/pdo_pgsql/tests/bug_33876.phpt index 45c65c6663..dc213f6abb 100644 --- a/ext/pdo_pgsql/tests/bug_33876.phpt +++ b/ext/pdo_pgsql/tests/bug_33876.phpt @@ -3,14 +3,14 @@ PDO PgSQL Bug #33876 (PDO misquotes/miscasts bool(false)) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT); $db->exec("SET LC_MESSAGES='C'"); diff --git a/ext/pdo_pgsql/tests/bug_49985.phpt b/ext/pdo_pgsql/tests/bug_49985.phpt index be5a4297bd..76d12f3f13 100644 --- a/ext/pdo_pgsql/tests/bug_49985.phpt +++ b/ext/pdo_pgsql/tests/bug_49985.phpt @@ -3,14 +3,14 @@ Bug #49985 (pdo_pgsql prepare() re-use previous aborted transaction) --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->exec("CREATE TABLE test (a int PRIMARY KEY)"); diff --git a/ext/pdo_pgsql/tests/common.phpt b/ext/pdo_pgsql/tests/common.phpt index 47281968be..c1341d7945 100644 --- a/ext/pdo_pgsql/tests/common.phpt +++ b/ext/pdo_pgsql/tests/common.phpt @@ -1,7 +1,7 @@ --TEST-- Postgres --SKIPIF-- -<?php # vim:ft=php +<?php if (!extension_loaded('pdo_pgsql')) print 'skip'; ?> --REDIRECTTEST-- # magic auto-configuration diff --git a/ext/pdo_pgsql/tests/config.inc b/ext/pdo_pgsql/tests/config.inc index 4fcfa47063..0fefe4664b 100644 --- a/ext/pdo_pgsql/tests/config.inc +++ b/ext/pdo_pgsql/tests/config.inc @@ -1,4 +1,4 @@ -<?php # vim:se ft=php: +<?php if (false !== getenv('PDO_PGSQL_TEST_DSN')) { # user set them from their shell $config['ENV']['PDOTEST_DSN'] = getenv('PDO_PGSQL_TEST_DSN'); diff --git a/ext/pdo_pgsql/tests/copy_from.phpt b/ext/pdo_pgsql/tests/copy_from.phpt index ba48114547..55a9df72aa 100644 --- a/ext/pdo_pgsql/tests/copy_from.phpt +++ b/ext/pdo_pgsql/tests/copy_from.phpt @@ -1,16 +1,16 @@ --TEST-- PDO PgSQL pgsqlCopyFromArray and pgsqlCopyFromFile --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); diff --git a/ext/pdo_pgsql/tests/copy_to.phpt b/ext/pdo_pgsql/tests/copy_to.phpt index cbcb49cd2d..3df882c93c 100644 --- a/ext/pdo_pgsql/tests/copy_to.phpt +++ b/ext/pdo_pgsql/tests/copy_to.phpt @@ -1,16 +1,16 @@ --TEST-- PDO PgSQL pgsqlCopyToArray and pgsqlCopyToFile --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); diff --git a/ext/pdo_pgsql/tests/debug_emulated_prepares.phpt b/ext/pdo_pgsql/tests/debug_emulated_prepares.phpt index ddbe4fea59..dfbbcb4ad4 100644 --- a/ext/pdo_pgsql/tests/debug_emulated_prepares.phpt +++ b/ext/pdo_pgsql/tests/debug_emulated_prepares.phpt @@ -3,14 +3,14 @@ PDO PgSQL PDOStatement::debugDumpParams() with emulated prepares --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $stmt = $db->prepare('SELECT :bool, :int, :string, :null'); diff --git a/ext/pdo_pgsql/tests/disable_prepares.phpt b/ext/pdo_pgsql/tests/disable_prepares.phpt index 99a7695404..bbc6a62e87 100644 --- a/ext/pdo_pgsql/tests/disable_prepares.phpt +++ b/ext/pdo_pgsql/tests/disable_prepares.phpt @@ -3,14 +3,14 @@ PDO PgSQL PGSQL_ATTR_DISABLE_PREPARES --SKIPIF-- <?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_COLUMN); diff --git a/ext/pdo_pgsql/tests/getnotify.phpt b/ext/pdo_pgsql/tests/getnotify.phpt index 27eef9d740..ad540e6c88 100644 --- a/ext/pdo_pgsql/tests/getnotify.phpt +++ b/ext/pdo_pgsql/tests/getnotify.phpt @@ -1,16 +1,16 @@ --TEST-- PDO PgSQL LISTEN/NOTIFY support --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // pgsqlGetPid should return something meaningful diff --git a/ext/pdo_pgsql/tests/is_in_transaction.phpt b/ext/pdo_pgsql/tests/is_in_transaction.phpt index 72da4f4e07..f5e950a047 100644 --- a/ext/pdo_pgsql/tests/is_in_transaction.phpt +++ b/ext/pdo_pgsql/tests/is_in_transaction.phpt @@ -1,16 +1,16 @@ --TEST-- PDO PgSQL isInTransaction --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); diff --git a/ext/pdo_pgsql/tests/large_objects.phpt b/ext/pdo_pgsql/tests/large_objects.phpt index 316963a383..6215e49cb5 100644 --- a/ext/pdo_pgsql/tests/large_objects.phpt +++ b/ext/pdo_pgsql/tests/large_objects.phpt @@ -1,16 +1,16 @@ --TEST-- PDO PgSQL Large Objects --SKIPIF-- -<?php # vim:se ft=php: +<?php if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded'); -require dirname(__FILE__) . '/config.inc'; -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; +require __DIR__ . '/config.inc'; +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; PDOTest::skip(); ?> --FILE-- <?php -require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; -$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt'); +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); |