From df481ef94167ded713b3d2574e50fd1f5caad496 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Mon, 3 Jun 2024 12:56:21 +0200 Subject: [PATCH] Simplify PDO include paths (#14444) PDO include paths can be simplified and synced as done in other extensions: either the project root directory or the phpincludedir (for the system installation). The 'ext' include is automatically appended when doing phpize build. In php-src it is only present on Windows build. The PHP_CHECK_PDO_INCLUDES is left intact working as before and checks if PDO headers are found. --- UPGRADING.INTERNALS | 2 ++ ext/pdo_dblib/config.m4 | 2 +- ext/pdo_dblib/dblib_driver.c | 4 ++-- ext/pdo_dblib/dblib_stmt.c | 4 ++-- ext/pdo_dblib/pdo_dblib.c | 4 ++-- ext/pdo_firebird/config.m4 | 2 +- ext/pdo_firebird/firebird_driver.c | 4 ++-- ext/pdo_firebird/firebird_statement.c | 4 ++-- ext/pdo_firebird/pdo_firebird.c | 4 ++-- ext/pdo_mysql/config.m4 | 2 +- ext/pdo_mysql/mysql_driver.c | 4 ++-- ext/pdo_mysql/mysql_statement.c | 4 ++-- ext/pdo_mysql/pdo_mysql.c | 4 ++-- ext/pdo_odbc/config.m4 | 2 +- ext/pdo_odbc/odbc_driver.c | 4 ++-- ext/pdo_odbc/odbc_stmt.c | 4 ++-- ext/pdo_odbc/pdo_odbc.c | 4 ++-- ext/pdo_pgsql/config.m4 | 2 +- ext/pdo_pgsql/pdo_pgsql.c | 6 +++--- ext/pdo_pgsql/pgsql_driver.c | 14 +++++++------- ext/pdo_pgsql/pgsql_statement.c | 4 ++-- ext/pdo_sqlite/config.m4 | 2 +- ext/pdo_sqlite/pdo_sqlite.c | 4 ++-- ext/pdo_sqlite/sqlite_driver.c | 4 ++-- ext/pdo_sqlite/sqlite_statement.c | 4 ++-- 25 files changed, 50 insertions(+), 48 deletions(-) diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index c491f83d5c9..a86af2d98ce 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -138,6 +138,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES - M4 macro PHP_CHECK_GCC_ARG has been removed since PHP 8.0 (use AX_CHECK_COMPILE_FLAG). - Added php-config --lib-dir and --lib-embed options for PHP embed SAPI. + - PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path + directory anymore. c. Windows build system changes - The configure options --with-oci8-11g, --with-oci8-12c, --with-oci8-19 have diff --git a/ext/pdo_dblib/config.m4 b/ext/pdo_dblib/config.m4 index 993ca3d6033..3cbadfee05c 100644 --- a/ext/pdo_dblib/config.m4 +++ b/ext/pdo_dblib/config.m4 @@ -44,7 +44,7 @@ if test "$PHP_PDO_DBLIB" != "no"; then PHP_CHECK_PDO_INCLUDES PDO_DBLIB_DEFS="-DPDO_DBLIB_FLAVOUR=\\\"freetds\\\"" - PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_DBLIB_DEFS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + PHP_NEW_EXTENSION(pdo_dblib, pdo_dblib.c dblib_driver.c dblib_stmt.c, $ext_shared,, $PDO_DBLIB_DEFS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) PHP_SUBST(PDO_DBLIB_SHARED_LIBADD) PHP_ADD_EXTENSION_DEP(pdo_dblib, pdo) diff --git a/ext/pdo_dblib/dblib_driver.c b/ext/pdo_dblib/dblib_driver.c index 72008c14e0d..cfce8c50461 100644 --- a/ext/pdo_dblib/dblib_driver.c +++ b/ext/pdo_dblib/dblib_driver.c @@ -22,8 +22,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_dblib.h" #include "php_pdo_dblib_int.h" #include "zend_exceptions.h" diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index c16eb07c596..e6e91b60fa2 100644 --- a/ext/pdo_dblib/dblib_stmt.c +++ b/ext/pdo_dblib/dblib_stmt.c @@ -22,8 +22,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_dblib.h" #include "php_pdo_dblib_int.h" #include "zend_exceptions.h" diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c index 7a1586f8a5f..b16208fbd8e 100644 --- a/ext/pdo_dblib/pdo_dblib.c +++ b/ext/pdo_dblib/pdo_dblib.c @@ -22,8 +22,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_dblib.h" #include "php_pdo_dblib_int.h" #include "zend_exceptions.h" diff --git a/ext/pdo_firebird/config.m4 b/ext/pdo_firebird/config.m4 index d4a245d5a90..b8352ec997a 100644 --- a/ext/pdo_firebird/config.m4 +++ b/ext/pdo_firebird/config.m4 @@ -60,7 +60,7 @@ if test "$PHP_PDO_FIREBIRD" != "no"; then PHP_CHECK_PDO_INCLUDES - PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_cv_inc_path) + PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared) PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD) PHP_ADD_EXTENSION_DEP(pdo_firebird, pdo) fi diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 88c6b8efa9b..8d62936bb37 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -26,8 +26,8 @@ #include "zend_exceptions.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 0b825df6bf2..25b965b796d 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" diff --git a/ext/pdo_firebird/pdo_firebird.c b/ext/pdo_firebird/pdo_firebird.c index 9f62e75eacc..ce4c6d69102 100644 --- a/ext/pdo_firebird/pdo_firebird.c +++ b/ext/pdo_firebird/pdo_firebird.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_firebird.h" #include "php_pdo_firebird_int.h" #include "pdo_firebird_arginfo.h" diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index 1c7c654af82..122376bdc02 100644 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -85,7 +85,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PDO_MYSQL_SOCKET", [ ]) fi - PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) + PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo) diff --git a/ext/pdo_mysql/mysql_driver.c b/ext/pdo_mysql/mysql_driver.c index 3295b67aa90..95d54500467 100644 --- a/ext/pdo_mysql/mysql_driver.c +++ b/ext/pdo_mysql/mysql_driver.c @@ -23,8 +23,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_mysql.h" #include "php_pdo_mysql_int.h" #ifndef PDO_USE_MYSQLND diff --git a/ext/pdo_mysql/mysql_statement.c b/ext/pdo_mysql/mysql_statement.c index c4f86b0e7d3..b4b7c8ecb60 100644 --- a/ext/pdo_mysql/mysql_statement.c +++ b/ext/pdo_mysql/mysql_statement.c @@ -23,8 +23,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_mysql.h" #include "php_pdo_mysql_int.h" diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index 469761abd92..cdf4b03d0f8 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -22,8 +22,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_mysql.h" #include "php_pdo_mysql_int.h" #include "pdo_mysql_arginfo.h" diff --git a/ext/pdo_odbc/config.m4 b/ext/pdo_odbc/config.m4 index 60a692647d4..0feb0bb230c 100644 --- a/ext/pdo_odbc/config.m4 +++ b/ext/pdo_odbc/config.m4 @@ -131,7 +131,7 @@ functions required for PDO support. AC_MSG_ERROR([Your ODBC library does not exist or there was an error. Check config.log for more information]) ], $PDO_ODBC_LDFLAGS) - PHP_NEW_EXTENSION(pdo_odbc, pdo_odbc.c odbc_driver.c odbc_stmt.c, $ext_shared,,-I$pdo_cv_inc_path $PDO_ODBC_INCLUDE) + PHP_NEW_EXTENSION(pdo_odbc, pdo_odbc.c odbc_driver.c odbc_stmt.c, $ext_shared,, $PDO_ODBC_INCLUDE) PHP_SUBST(PDO_ODBC_SHARED_LIBADD) PHP_ADD_EXTENSION_DEP(pdo_odbc, pdo) fi diff --git a/ext/pdo_odbc/odbc_driver.c b/ext/pdo_odbc/odbc_driver.c index 9e5c6eb7d54..d991b8dc5fe 100644 --- a/ext/pdo_odbc/odbc_driver.c +++ b/ext/pdo_odbc/odbc_driver.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" /* this file actually lives in main/ */ #include "php_odbc_utils.h" #include "php_pdo_odbc.h" diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index ea0dd0e53aa..00901e10af4 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_odbc.h" #include "php_pdo_odbc_int.h" diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c index 675776fb908..40303609b3b 100644 --- a/ext/pdo_odbc/pdo_odbc.c +++ b/ext/pdo_odbc/pdo_odbc.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_odbc.h" #include "php_pdo_odbc_int.h" #include "pdo_odbc_arginfo.h" diff --git a/ext/pdo_pgsql/config.m4 b/ext/pdo_pgsql/config.m4 index a21b11106ba..492a2e8b66a 100644 --- a/ext/pdo_pgsql/config.m4 +++ b/ext/pdo_pgsql/config.m4 @@ -79,6 +79,6 @@ if test "$PHP_PDO_PGSQL" != "no"; then 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_NEW_EXTENSION(pdo_pgsql, pdo_pgsql.c pgsql_driver.c pgsql_statement.c, $ext_shared) PHP_ADD_EXTENSION_DEP(pdo_pgsql, pdo) fi diff --git a/ext/pdo_pgsql/pdo_pgsql.c b/ext/pdo_pgsql/pdo_pgsql.c index d9858d7bebc..77544d272d4 100644 --- a/ext/pdo_pgsql/pdo_pgsql.c +++ b/ext/pdo_pgsql/pdo_pgsql.c @@ -21,9 +21,9 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_error.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_error.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_pgsql.h" #include "php_pdo_pgsql_int.h" #include "pdo_pgsql_arginfo.h" diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c index 42e0c307d63..41d9fa85e51 100644 --- a/ext/pdo_pgsql/pgsql_driver.c +++ b/ext/pdo_pgsql/pgsql_driver.c @@ -24,9 +24,9 @@ #include "php_ini.h" #include "ext/standard/php_string.h" /* For php_addcslashes_str() in _pdo_pgsql_escape_credentials() */ #include "main/php_network.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" -#include "pdo/php_pdo_error.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo_error.h" #include "ext/standard/file.h" #include "php_pdo_pgsql.h" #include "php_pdo_pgsql_int.h" @@ -1250,14 +1250,14 @@ PHP_METHOD(PDO_PGSql_Ext, pgsqlSetNoticeCallback) if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "F!", &fci, &fcc)) { RETURN_THROWS(); } - + pdo_dbh_t *dbh = Z_PDO_DBH_P(ZEND_THIS); PDO_CONSTRUCT_CHECK; - + pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh->driver_data; - + pdo_pgsql_cleanup_notice_callback(H); - + if (ZEND_FCC_INITIALIZED(fcc)) { H->notice_callback = emalloc(sizeof(zend_fcall_info_cache)); zend_fcc_dup(H->notice_callback, &fcc); diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 7843902a9a3..1b2a59e4852 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -23,8 +23,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_pgsql.h" #include "php_pdo_pgsql_int.h" #ifdef HAVE_NETINET_IN_H diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 index bd4e51bf7f7..62c738f01e8 100644 --- a/ext/pdo_sqlite/config.m4 +++ b/ext/pdo_sqlite/config.m4 @@ -30,7 +30,7 @@ if test "$PHP_PDO_SQLITE" != "no"; then PHP_SUBST(PDO_SQLITE_SHARED_LIBADD) PHP_NEW_EXTENSION(pdo_sqlite, pdo_sqlite.c sqlite_driver.c sqlite_statement.c, - $ext_shared,,-I$pdo_cv_inc_path) + $ext_shared) PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo) fi diff --git a/ext/pdo_sqlite/pdo_sqlite.c b/ext/pdo_sqlite/pdo_sqlite.c index 852f0310f75..49a477998b0 100644 --- a/ext/pdo_sqlite/pdo_sqlite.c +++ b/ext/pdo_sqlite/pdo_sqlite.c @@ -22,8 +22,8 @@ #include "php_ini.h" #include "ext/standard/info.h" #include "SAPI.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_sqlite.h" #include "php_pdo_sqlite_int.h" #include "zend_exceptions.h" diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 4d2d9280cef..76e82cc2e61 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_sqlite.h" #include "php_pdo_sqlite_int.h" #include "zend_exceptions.h" diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index c6b907f6fc2..77bc65a4f09 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -21,8 +21,8 @@ #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" -#include "pdo/php_pdo.h" -#include "pdo/php_pdo_driver.h" +#include "ext/pdo/php_pdo.h" +#include "ext/pdo/php_pdo_driver.h" #include "php_pdo_sqlite.h" #include "php_pdo_sqlite_int.h"