From 6a8672b7f0c5e607de04968c46d911feef4004fb Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Jun 2023 07:49:32 +0200 Subject: update to 8.3.0alpha2 fix build with old libpq on EL-7 using patch from https://github.com/php/php-src/pull/11495 --- failed.txt | 14 ++--- php-pgsql92.patch | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php.spec | 9 ++- 3 files changed, 184 insertions(+), 9 deletions(-) create mode 100644 php-pgsql92.patch diff --git a/failed.txt b/failed.txt index f5a673c..4a71e93 100644 --- a/failed.txt +++ b/failed.txt @@ -1,16 +1,14 @@ -===== 8.3.0alpha1 (2023-06-08) +===== 8.3.0alpha2 (2023-06-22) $ grep -ar 'Tests failed' /var/lib/mock/*/build.log -/var/lib/mock/scl82el7x/build.log:Tests failed : 2 -/var/lib/mock/scl82el8x/build.log:Tests failed : 1 -/var/lib/mock/scl82el9x/build.log:Tests failed : 1 -/var/lib/mock/scl82fc37x/build.log:Tests failed : 1 -/var/lib/mock/scl82fc38x/build.log:Tests failed : 3 +/var/lib/mock/scl82el7x/build.log:Tests failed : 1 +/var/lib/mock/scl82el8x/build.log:Tests failed : 0 +/var/lib/mock/scl82el9x/build.log:Tests failed : 0 +/var/lib/mock/scl82fc37x/build.log:Tests failed : 0 +/var/lib/mock/scl82fc38x/build.log:Tests failed : 2 -all: - 3 ext/session/tests/session_regenerate_id_cookie.phpt el7x: 5 ext/standard/tests/directory/bug74589_utf8.phpt fc38x: diff --git a/php-pgsql92.patch b/php-pgsql92.patch new file mode 100644 index 0000000..d091e7f --- /dev/null +++ b/php-pgsql92.patch @@ -0,0 +1,170 @@ +From e1e23d83fa7717db8ef913dc9e5829224811abe3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Wed, 21 Jun 2023 07:37:11 +0200 +Subject: [PATCH] check PQsetErrorContextVisibility availability (libpq >= 9.6) + +--- + UPGRADING | 3 ++- + ext/pgsql/config.m4 | 1 + + ext/pgsql/pgsql.c | 2 ++ + ext/pgsql/pgsql.stub.php | 5 ++++- + ext/pgsql/pgsql_arginfo.h | 14 +++++++++++++- + ext/pgsql/tests/07optional.phpt | 8 +++++--- + 6 files changed, 27 insertions(+), 6 deletions(-) + +diff --git a/UPGRADING b/UPGRADING +index df3d0396620d..c981849a6012 100644 +--- a/UPGRADING ++++ b/UPGRADING +@@ -219,7 +219,8 @@ PHP 8.3 UPGRADE NOTES + . Added posix_eaccess call to check the effective user id's permission for a path. + + - PGSQL: +- . Added pg_set_error_context_visilibity to set the visibility of the context in error messages. ++ . Added pg_set_error_context_visilibity to set the visibility of the context ++ in error messages (with libpq >= 9.6). + + - Random: + . Added Randomizer::getBytesFromString(). +diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4 +index 5291b2612070..669a9f7b61aa 100644 +--- a/ext/pgsql/config.m4 ++++ b/ext/pgsql/config.m4 +@@ -65,6 +65,7 @@ if test "$PHP_PGSQL" != "no"; then + AC_CHECK_LIB(pq, PQlibVersion,, AC_MSG_ERROR([Unable to build the PostgreSQL extension: at least libpq 9.1 is required])) + AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) + AC_CHECK_LIB(pq, lo_truncate64, AC_DEFINE(HAVE_PG_LO64,1,[PostgreSQL 9.3 or later])) ++ AC_CHECK_LIB(pq, PQsetErrorContextVisibility, AC_DEFINE(HAVE_PG_CONTEXT_VISIBILITY,1,[PostgreSQL 9.6 or later])) + LIBS=$old_LIBS + LDFLAGS=$old_LDFLAGS + +diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c +index 9779193bd0ea..c72837ce38d2 100644 +--- a/ext/pgsql/pgsql.c ++++ b/ext/pgsql/pgsql.c +@@ -2834,6 +2834,7 @@ PHP_FUNCTION(pg_set_error_verbosity) + } + /* }}} */ + ++#ifdef HAVE_PG_CONTEXT_VISIBILITY + PHP_FUNCTION(pg_set_error_context_visibility) + { + zval *pgsql_link = NULL; +@@ -2856,6 +2857,7 @@ PHP_FUNCTION(pg_set_error_context_visibility) + RETURN_THROWS(); + } + } ++#endif + + /* {{{ Set client encoding */ + PHP_FUNCTION(pg_set_client_encoding) +diff --git a/ext/pgsql/pgsql.stub.php b/ext/pgsql/pgsql.stub.php +index 1b5356bd7be9..46c82e324ac2 100644 +--- a/ext/pgsql/pgsql.stub.php ++++ b/ext/pgsql/pgsql.stub.php +@@ -463,6 +463,7 @@ + const PGSQL_PIPELINE_ABORTED = UNKNOWN; + #endif + ++#ifdef HAVE_PG_CONTEXT_VISIBILITY + /* For pg_set_error_context_visibility() */ + + /** +@@ -480,7 +481,7 @@ + * @cvalue PQSHOW_CONTEXT_ALWAYS + */ + const PGSQL_SHOW_CONTEXT_ALWAYS = UNKNOWN; +- ++#endif + + function pg_connect(string $connection_string, int $flags = 0): PgSql\Connection|false {} + +@@ -971,7 +972,9 @@ function pg_pipeline_sync(PgSql\Connection $connection): bool {} + function pg_pipeline_status(PgSql\Connection $connection): int {} + #endif + ++#ifdef HAVE_PG_CONTEXT_VISIBILITY + function pg_set_error_context_visibility(PgSql\Connection $connection, int $visibility): int {} ++#endif + } + + namespace PgSql { +diff --git a/ext/pgsql/pgsql_arginfo.h b/ext/pgsql/pgsql_arginfo.h +index 26e0777b1cbf..8eb1b43d56b1 100644 +--- a/ext/pgsql/pgsql_arginfo.h ++++ b/ext/pgsql/pgsql_arginfo.h +@@ -1,5 +1,5 @@ + /* This is a generated file, edit the .stub.php file instead. +- * Stub hash: a37be19da43ac0838655b0ba7e34382e9c7424f5 */ ++ * Stub hash: fb57575ac2153c888b95c18a7bf6d6a7e200f5dc */ + + ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE) + ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0) +@@ -472,10 +472,12 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_pipeline_status, 0, 1, IS_LON + ZEND_END_ARG_INFO() + #endif + ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_set_error_context_visibility, 0, 2, IS_LONG, 0) + ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0) + ZEND_ARG_TYPE_INFO(0, visibility, IS_LONG, 0) + ZEND_END_ARG_INFO() ++#endif + + + ZEND_FUNCTION(pg_connect); +@@ -579,7 +581,9 @@ ZEND_FUNCTION(pg_pipeline_sync); + #if defined(LIBPQ_HAS_PIPELINING) + ZEND_FUNCTION(pg_pipeline_status); + #endif ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + ZEND_FUNCTION(pg_set_error_context_visibility); ++#endif + + + static const zend_function_entry ext_functions[] = { +@@ -709,7 +713,9 @@ static const zend_function_entry ext_functions[] = { + #if defined(LIBPQ_HAS_PIPELINING) + ZEND_FE(pg_pipeline_status, arginfo_pg_pipeline_status) + #endif ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + ZEND_FE(pg_set_error_context_visibility, arginfo_pg_set_error_context_visibility) ++#endif + ZEND_FE_END + }; + +@@ -842,9 +848,15 @@ static void register_pgsql_symbols(int module_number) + #if defined(LIBPQ_HAS_PIPELINING) + REGISTER_LONG_CONSTANT("PGSQL_PIPELINE_ABORTED", PQ_PIPELINE_ABORTED, CONST_PERSISTENT); + #endif ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + REGISTER_LONG_CONSTANT("PGSQL_SHOW_CONTEXT_NEVER", PQSHOW_CONTEXT_NEVER, CONST_PERSISTENT); ++#endif ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + REGISTER_LONG_CONSTANT("PGSQL_SHOW_CONTEXT_ERRORS", PQSHOW_CONTEXT_ERRORS, CONST_PERSISTENT); ++#endif ++#if defined(HAVE_PG_CONTEXT_VISIBILITY) + REGISTER_LONG_CONSTANT("PGSQL_SHOW_CONTEXT_ALWAYS", PQSHOW_CONTEXT_ALWAYS, CONST_PERSISTENT); ++#endif + } + + static zend_class_entry *register_class_PgSql_Connection(void) +diff --git a/ext/pgsql/tests/07optional.phpt b/ext/pgsql/tests/07optional.phpt +index 41f89ca6c8c3..ac57cd424009 100644 +--- a/ext/pgsql/tests/07optional.phpt ++++ b/ext/pgsql/tests/07optional.phpt +@@ -21,9 +21,11 @@ if (function_exists('pg_set_error_verbosity')) { + pg_set_error_verbosity($db, PGSQL_ERRORS_VERBOSE); + pg_set_error_verbosity($db, PGSQL_ERRORS_SQLSTATE); + } +-pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_NEVER); +-pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_ERRORS); +-pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_ALWAYS); ++if (function_exists('pg_set_error_context_visibility')) { ++ pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_NEVER); ++ pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_ERRORS); ++ pg_set_error_context_visibility($db, PGSQL_SHOW_CONTEXT_ALWAYS); ++} + echo "OK"; + ?> + --EXPECT-- diff --git a/php.spec b/php.spec index 674f6ed..a82049c 100644 --- a/php.spec +++ b/php.spec @@ -123,7 +123,7 @@ %global gh_owner php %global gh_project php-src %global upver 8.3.0 -%global rcver alpha1 +%global rcver alpha2 %global lower %(echo %{rcver} | tr '[:upper:]' '[:lower:]') Summary: PHP scripting language for creating dynamic web sites @@ -192,6 +192,7 @@ Patch47: php-8.1.0-phpinfo.patch Patch91: php-7.2.0-oci8conf.patch # Upstream fixes (100+) +Patch100: php-pgsql92.patch # Security fixes (200+) @@ -973,6 +974,7 @@ sed -e 's/php-devel/%{?scl_prefix}php-devel/' -i scripts/phpize.in %patch -P91 -p1 -b .remi-oci8 # upstream patches +%patch -P100 -p1 -b .pgsql92 # security patches @@ -1854,6 +1856,11 @@ fi %changelog +* Wed Jun 21 2023 Remi Collet - 8.3.0~alpha2-1 +- update to 8.3.0alpha2 +- fix build with old libpq on EL-7 using patch from + https://github.com/php/php-src/pull/11495 + * Tue Jun 6 2023 Remi Collet - 8.3.0~alpha1-1 - update to 8.3.0alpha1 -- cgit