From 329a894341b196feda4dce9db40401614faf7947 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 2 Sep 2021 09:35:47 +0200 Subject: update to 8.1.0RC1 bump API version --- .gitignore | 1 + 10-opcache.ini | 4 +- failed.txt | 7 +- php-7.4.0-libdb.patch | 92 ------ php-8.0.0-parser.patch | 2 +- php-8.0.0-phpinfo.patch | 118 -------- php-8.0.10-phar-sha.patch | 515 -------------------------------- php-8.0.10-snmp-sha.patch | 143 --------- php-8.0.10-systzdata-v20.patch | 660 ---------------------------------------- php-8.0.6-deprecated.patch | 400 ------------------------- php-8.1.0-libdb.patch | 92 ++++++ php-8.1.0-phpinfo.patch | 44 +++ php-8.1.0-systzdata-v21.patch | 662 +++++++++++++++++++++++++++++++++++++++++ php.ini | 354 +++++++++++----------- php81.spec | 75 ++--- 15 files changed, 1024 insertions(+), 2145 deletions(-) delete mode 100644 php-7.4.0-libdb.patch delete mode 100644 php-8.0.0-phpinfo.patch delete mode 100644 php-8.0.10-phar-sha.patch delete mode 100644 php-8.0.10-snmp-sha.patch delete mode 100644 php-8.0.10-systzdata-v20.patch delete mode 100644 php-8.0.6-deprecated.patch create mode 100644 php-8.1.0-libdb.patch create mode 100644 php-8.1.0-phpinfo.patch create mode 100644 php-8.1.0-systzdata-v21.patch diff --git a/.gitignore b/.gitignore index 5456ae4..d51b362 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ package-*.xml *.src.rpm */*rpm tembed +TODO diff --git a/10-opcache.ini b/10-opcache.ini index a5be172..d188ef0 100644 --- a/10-opcache.ini +++ b/10-opcache.ini @@ -136,12 +136,12 @@ opcache.huge_code_pages=0 ; Specifies a PHP script that is going to be compiled and executed at server ; start-up. -; http://php.net/opcache.preload +; https://php.net/opcache.preload ;opcache.preload= ; Preloading code as root is not allowed for security reasons. This directive ; facilitates to let the preloading to be run as another user. -; http://php.net/opcache.preload_user +; https://php.net/opcache.preload_user ;opcache.preload_user= ; Prevents caching files that are less than this number of seconds old. It diff --git a/failed.txt b/failed.txt index 1bed4f1..77c7e51 100644 --- a/failed.txt +++ b/failed.txt @@ -1,14 +1,15 @@ -===== 8.0.10 (2021-08-26) +===== 8.1.0RC1 (2021-09-02) $ grep -ar 'Tests failed' /var/lib/mock/{fc,el}*/build.log -/var/lib/mock/el7x/build.log:Tests failed : 0 +/var/lib/mock/el7x/build.log:Tests failed : 1 /var/lib/mock/el8x80/build.log:Tests failed : 0 -/var/lib/mock/fc32x/build.log:Tests failed : 0 /var/lib/mock/fc33x/build.log:Tests failed : 0 /var/lib/mock/fc34x/build.log:Tests failed : 0 +el7x: + 4 Bug #80963: DateTimeZone::getTransitions() truncated [ext/date/tests/bug80963.phpt] 1 proc_open give erratic test results :( diff --git a/php-7.4.0-libdb.patch b/php-7.4.0-libdb.patch deleted file mode 100644 index d7c6289..0000000 --- a/php-7.4.0-libdb.patch +++ /dev/null @@ -1,92 +0,0 @@ -diff -up ./ext/dba/config.m4.libdb ./ext/dba/config.m4 ---- ./ext/dba/config.m4.libdb 2020-04-09 14:06:11.000000000 +0200 -+++ ./ext/dba/config.m4 2020-04-09 14:35:08.208605065 +0200 -@@ -375,61 +375,13 @@ if test "$PHP_DB4" != "no"; then - dbdp4="/usr/local/BerkeleyDB.4." - dbdp5="/usr/local/BerkeleyDB.5." - for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do -- if test -f "$i/db5/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/db5/db.h -- break -- elif test -f "$i/db4/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/db4/db.h -- break -- elif test -f "$i/include/db5.3/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db5.3/db.h -- break -- elif test -f "$i/include/db5.1/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db5.1/db.h -- break -- elif test -f "$i/include/db5.0/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db5.0/db.h -- break -- elif test -f "$i/include/db4.8/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.8/db.h -- break -- elif test -f "$i/include/db4.7/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.7/db.h -- break -- elif test -f "$i/include/db4.6/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.6/db.h -- break -- elif test -f "$i/include/db4.5/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.5/db.h -- break -- elif test -f "$i/include/db4/db.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4/db.h -- break -- elif test -f "$i/include/db/db4.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db/db4.h -- break -- elif test -f "$i/include/db4.h"; then -- THIS_PREFIX=$i -- THIS_INCLUDE=$i/include/db4.h -- break -- elif test -f "$i/include/db.h"; then -+ if test -f "$i/include/db.h"; then - THIS_PREFIX=$i - THIS_INCLUDE=$i/include/db.h - break - fi - done -- PHP_DBA_DB_CHECK(4, db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) -+ PHP_DBA_DB_CHECK(4, db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) - fi - PHP_DBA_STD_RESULT(db4,Berkeley DB4) - -diff -up ./ext/dba/dba.c.libdb ./ext/dba/dba.c ---- ./ext/dba/dba.c.libdb 2020-04-09 14:06:11.000000000 +0200 -+++ ./ext/dba/dba.c 2020-04-09 14:36:30.593275190 +0200 -@@ -50,6 +50,10 @@ - #include "php_lmdb.h" - #include "dba_arginfo.h" - -+#ifdef DB4_INCLUDE_FILE -+#include DB4_INCLUDE_FILE -+#endif -+ - PHP_MINIT_FUNCTION(dba); - PHP_MSHUTDOWN_FUNCTION(dba); - PHP_MINFO_FUNCTION(dba); -@@ -459,6 +463,10 @@ PHP_MINFO_FUNCTION(dba) - - php_info_print_table_start(); - php_info_print_table_row(2, "DBA support", "enabled"); -+#ifdef DB_VERSION_STRING -+ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); -+ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); -+#endif - if (handlers.s) { - smart_str_0(&handlers); - php_info_print_table_row(2, "Supported handlers", ZSTR_VAL(handlers.s)); diff --git a/php-8.0.0-parser.patch b/php-8.0.0-parser.patch index f5da3b5..f443f1d 100644 --- a/php-8.0.0-parser.patch +++ b/php-8.0.0-parser.patch @@ -11,6 +11,6 @@ diff -up ./build/gen_stub.php.syslib ./build/gen_stub.php + return; + } + - $version = "4.9.0"; + $version = "4.12.0"; $phpParserDir = __DIR__ . "/PHP-Parser-$version"; if (!is_dir($phpParserDir)) { diff --git a/php-8.0.0-phpinfo.patch b/php-8.0.0-phpinfo.patch deleted file mode 100644 index 391d996..0000000 --- a/php-8.0.0-phpinfo.patch +++ /dev/null @@ -1,118 +0,0 @@ - -Drop "Configure Command" from phpinfo as it doesn't -provide any useful information. -The available extensions are not related to this command. - -Replace full GCC name by gcc in php -v output - - -Also apply - -From 9bf43c45908433d382f0499d529849172d0d8206 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Mon, 28 Dec 2020 08:33:09 +0100 -Subject: [PATCH] rename COMPILER and ARCHITECTURE macro (too generic) - ---- - configure.ac | 4 ++-- - ext/standard/info.c | 8 ++++---- - sapi/cli/php_cli.c | 8 ++++---- - win32/build/confutils.js | 10 +++++----- - 4 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 9d9c8b155b07..143dc061346b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1289,10 +1289,10 @@ if test -n "${PHP_BUILD_PROVIDER}"; then - AC_DEFINE_UNQUOTED(PHP_BUILD_PROVIDER,"$PHP_BUILD_PROVIDER",[build provider]) - fi - if test -n "${PHP_BUILD_COMPILER}"; then -- AC_DEFINE_UNQUOTED(COMPILER,"$PHP_BUILD_COMPILER",[used compiler for build]) -+ AC_DEFINE_UNQUOTED(PHP_BUILD_COMPILER,"$PHP_BUILD_COMPILER",[used compiler for build]) - fi - if test -n "${PHP_BUILD_ARCH}"; then -- AC_DEFINE_UNQUOTED(ARCHITECTURE,"$PHP_BUILD_ARCH",[build architecture]) -+ AC_DEFINE_UNQUOTED(PHP_BUILD_ARCH,"$PHP_BUILD_ARCH",[build architecture]) - fi - - PHP_SUBST_OLD(PHP_INSTALLED_SAPIS) -diff --git a/ext/standard/info.c b/ext/standard/info.c -index 153cb6cde014..8ceef31d9fe4 100644 ---- a/ext/standard/info.c -+++ b/ext/standard/info.c -@@ -798,11 +798,11 @@ PHPAPI ZEND_COLD void php_print_info(int flag) - #ifdef PHP_BUILD_PROVIDER - php_info_print_table_row(2, "Build Provider", PHP_BUILD_PROVIDER); - #endif --#ifdef COMPILER -- php_info_print_table_row(2, "Compiler", COMPILER); -+#ifdef PHP_BUILD_COMPILER -+ php_info_print_table_row(2, "Compiler", PHP_BUILD_COMPILER); - #endif --#ifdef ARCHITECTURE -- php_info_print_table_row(2, "Architecture", ARCHITECTURE); -+#ifdef PHP_BUILD_ARCH -+ php_info_print_table_row(2, "Architecture", PHP_BUILD_ARCH); - #endif - #ifdef CONFIGURE_COMMAND - php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); -diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c -index 5092fb0ffd68..9d296acec631 100644 ---- a/sapi/cli/php_cli.c -+++ b/sapi/cli/php_cli.c -@@ -640,12 +640,12 @@ static int do_cli(int argc, char **argv) /* {{{ */ - #else - "NTS " - #endif --#ifdef COMPILER -- COMPILER -+#ifdef PHP_BUILD_COMPILER -+ PHP_BUILD_COMPILER - " " - #endif --#ifdef ARCHITECTURE -- ARCHITECTURE -+#ifdef PHP_BUILD_ARCH -+ PHP_BUILD_ARCH - " " - #endif - #if ZEND_DEBUG - -diff -up ./ext/standard/info.c.phpinfo ./ext/standard/info.c ---- ./ext/standard/info.c.phpinfo 2020-07-21 10:49:31.000000000 +0200 -+++ ./ext/standard/info.c 2020-07-21 11:41:56.295633523 +0200 -@@ -804,9 +804,6 @@ PHPAPI ZEND_COLD void php_print_info(int - #ifdef PHP_BUILD_ARCH - php_info_print_table_row(2, "Architecture", PHP_BUILD_ARCH); - #endif --#ifdef CONFIGURE_COMMAND -- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); --#endif - - if (sapi_module.pretty_name) { - php_info_print_table_row(2, "Server API", sapi_module.pretty_name ); -diff -up ./ext/standard/tests/general_functions/phpinfo.phpt.phpinfo ./ext/standard/tests/general_functions/phpinfo.phpt ---- ./ext/standard/tests/general_functions/phpinfo.phpt.phpinfo 2020-07-21 10:49:31.000000000 +0200 -+++ ./ext/standard/tests/general_functions/phpinfo.phpt 2020-07-21 11:41:56.296633522 +0200 -@@ -17,7 +17,6 @@ PHP Version => %s - - System => %s - Build Date => %s%a --Configure Command => %s - Server API => Command Line Interface - Virtual Directory Support => %s - Configuration File (php.ini) Path => %s -diff -up ./sapi/cli/php_cli.c.phpinfo ./sapi/cli/php_cli.c ---- ./sapi/cli/php_cli.c.phpinfo 2020-07-21 11:43:38.812475300 +0200 -+++ ./sapi/cli/php_cli.c 2020-07-21 11:43:45.783464540 +0200 -@@ -641,8 +641,7 @@ static int do_cli(int argc, char **argv) - "NTS " - #endif - #ifdef PHP_BUILD_COMPILER -- PHP_BUILD_COMPILER -- " " -+ "gcc " - #endif - #ifdef PHP_BUILD_ARCH - PHP_BUILD_ARCH diff --git a/php-8.0.10-phar-sha.patch b/php-8.0.10-phar-sha.patch deleted file mode 100644 index 7d6fa2c..0000000 --- a/php-8.0.10-phar-sha.patch +++ /dev/null @@ -1,515 +0,0 @@ -Backported for 8.0 from - - -From 8bb0c74e24359a11216824117ac3adf3d5ef7b71 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 5 Aug 2021 11:10:15 +0200 -Subject: [PATCH] switch phar to use sha256 signature by default - ---- - ext/phar/phar/pharcommand.inc | 2 +- - ext/phar/tests/create_new_and_modify.phpt | 4 ++-- - ext/phar/tests/create_new_phar_c.phpt | 4 ++-- - ext/phar/tests/phar_setsignaturealgo2.phpt | 2 +- - ext/phar/tests/tar/phar_setsignaturealgo2.phpt | 2 +- - ext/phar/tests/zip/phar_setsignaturealgo2.phpt | 2 +- - ext/phar/util.c | 6 +++--- - ext/phar/zip.c | 2 +- - 8 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc -index a31290eee75fe..5f698b4bec26b 100644 ---- a/ext/phar/phar/pharcommand.inc -+++ b/ext/phar/phar/pharcommand.inc -@@ -92,7 +92,7 @@ class PharCommand extends CLICommand - 'typ' => 'select', - 'val' => NULL, - 'inf' => ' Selects the hash algorithm.', -- 'select' => array('md5' => 'MD5','sha1' => 'SHA1') -+ 'select' => array('md5' => 'MD5','sha1' => 'SHA1', 'sha256' => 'SHA256', 'sha512' => 'SHA512', 'openssl' => 'OPENSSL') - ), - 'i' => array( - 'typ' => 'regex', -diff --git a/ext/phar/tests/create_new_and_modify.phpt b/ext/phar/tests/create_new_and_modify.phpt -index 02e36c6cea2fe..32defcae8a639 100644 ---- a/ext/phar/tests/create_new_and_modify.phpt -+++ b/ext/phar/tests/create_new_and_modify.phpt -@@ -49,8 +49,8 @@ include $pname . '/b.php'; - - --EXPECTF-- - brand new! --string(40) "%s" --string(40) "%s" -+string(%d) "%s" -+string(%d) "%s" - bool(true) - modified! - another! -diff --git a/ext/phar/tests/create_new_phar_c.phpt b/ext/phar/tests/create_new_phar_c.phpt -index 566d3c4d5f8ad..bf6d740fd1d10 100644 ---- a/ext/phar/tests/create_new_phar_c.phpt -+++ b/ext/phar/tests/create_new_phar_c.phpt -@@ -20,7 +20,7 @@ var_dump($phar->getSignature()); - --EXPECTF-- - array(2) { - ["hash"]=> -- string(40) "%s" -+ string(64) "%s" - ["hash_type"]=> -- string(5) "SHA-1" -+ string(7) "SHA-256" - } -diff --git a/ext/phar/tests/phar_setsignaturealgo2.phpt b/ext/phar/tests/phar_setsignaturealgo2.phpt -index 293d3196713d8..4f31836fbbbcc 100644 ---- a/ext/phar/tests/phar_setsignaturealgo2.phpt -+++ b/ext/phar/tests/phar_setsignaturealgo2.phpt -@@ -52,7 +52,7 @@ array(2) { - ["hash"]=> - string(%d) "%s" - ["hash_type"]=> -- string(5) "SHA-1" -+ string(7) "SHA-256" - } - array(2) { - ["hash"]=> -diff --git a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -index 9923ac5c88476..cc10a241d739b 100644 ---- a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -+++ b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -@@ -51,7 +51,7 @@ array(2) { - ["hash"]=> - string(%d) "%s" - ["hash_type"]=> -- string(5) "SHA-1" -+ string(7) "SHA-256" - } - array(2) { - ["hash"]=> -diff --git a/ext/phar/tests/zip/phar_setsignaturealgo2.phpt b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt -index 8de77479d7825..60fec578ee894 100644 ---- a/ext/phar/tests/zip/phar_setsignaturealgo2.phpt -+++ b/ext/phar/tests/zip/phar_setsignaturealgo2.phpt -@@ -78,7 +78,7 @@ array(2) { - ["hash"]=> - string(%d) "%s" - ["hash_type"]=> -- string(5) "SHA-1" -+ string(7) "SHA-256" - } - array(2) { - ["hash"]=> -diff --git a/ext/phar/util.c b/ext/phar/util.c -index 314acfe81a788..8d2db03b69601 100644 ---- a/ext/phar/util.c -+++ b/ext/phar/util.c -@@ -1798,6 +1798,8 @@ int phar_create_signature(phar_archive_d - *signature_length = 64; - break; - } -+ default: -+ phar->sig_flags = PHAR_SIG_SHA256; - case PHAR_SIG_SHA256: { - unsigned char digest[32]; - PHP_SHA256_CTX context; -@@ -1894,8 +1896,6 @@ int phar_create_signature(phar_archive_d - *signature_length = siglen; - } - break; -- default: -- phar->sig_flags = PHAR_SIG_SHA1; - case PHAR_SIG_SHA1: { - unsigned char digest[20]; - PHP_SHA1_CTX context; -diff --git a/ext/phar/zip.c b/ext/phar/zip.c -index 31d4bd2998215..c5e38cabf7b87 100644 ---- a/ext/phar/zip.c -+++ b/ext/phar/zip.c -@@ -1423,7 +1423,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long len, int - - memcpy(eocd.signature, "PK\5\6", 4); - if (!phar->is_data && !phar->sig_flags) { -- phar->sig_flags = PHAR_SIG_SHA1; -+ phar->sig_flags = PHAR_SIG_SHA256; - } - if (phar->sig_flags) { - PHAR_SET_16(eocd.counthere, zend_hash_num_elements(&phar->manifest) + 1); - -From c51af22fef988c1b2f92b7b9e3a9d745f7084815 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 5 Aug 2021 16:49:48 +0200 -Subject: [PATCH] implement openssl_256 and openssl_512 for phar singatures - ---- - ext/openssl/openssl.c | 1 + - ext/phar/phar.1.in | 10 +++- - ext/phar/phar.c | 8 +++- - ext/phar/phar/pharcommand.inc | 14 +++++- - ext/phar/phar_internal.h | 2 + - ext/phar/phar_object.c | 24 ++++++++-- - ext/phar/tests/files/openssl256.phar | Bin 0 -> 7129 bytes - ext/phar/tests/files/openssl256.phar.pubkey | 6 +++ - ext/phar/tests/files/openssl512.phar | Bin 0 -> 7129 bytes - ext/phar/tests/files/openssl512.phar.pubkey | 6 +++ - .../phar_get_supported_signatures_002a.phpt | 6 ++- - .../tests/tar/phar_setsignaturealgo2.phpt | 16 +++++++ - ext/phar/tests/test_signaturealgos.phpt | 8 ++++ - ext/phar/util.c | 45 ++++++++++++++---- - 14 files changed, 128 insertions(+), 18 deletions(-) - create mode 100644 ext/phar/tests/files/openssl256.phar - create mode 100644 ext/phar/tests/files/openssl256.phar.pubkey - create mode 100644 ext/phar/tests/files/openssl512.phar - create mode 100644 ext/phar/tests/files/openssl512.phar.pubkey - -diff --git a/ext/phar/phar.1.in b/ext/phar/phar.1.in -index 77912b241dfd5..323e77b0e2a3b 100644 ---- a/ext/phar/phar.1.in -+++ b/ext/phar/phar.1.in -@@ -475,7 +475,15 @@ SHA512 - .TP - .PD - .B openssl --OpenSSL -+OpenSSL using SHA-1 -+.TP -+.PD -+.B openssl_sha256 -+OpenSSL using SHA-256 -+.TP -+.PD -+.B openssl_sha512 -+OpenSSL using SHA-512 - - .SH SEE ALSO - For a more or less complete description of PHAR look here: -diff --git a/ext/phar/phar.c b/ext/phar/phar.c -index 77f21cef9da53..bc08e4edde05d 100644 ---- a/ext/phar/phar.c -+++ b/ext/phar/phar.c -@@ -869,6 +869,8 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, size_t fname_len, ch - PHAR_GET_32(sig_ptr, sig_flags); - - switch(sig_flags) { -+ case PHAR_SIG_OPENSSL_SHA512: -+ case PHAR_SIG_OPENSSL_SHA256: - case PHAR_SIG_OPENSSL: { - uint32_t signature_len; - char *sig; -@@ -903,7 +905,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, size_t fname_len, ch - return FAILURE; - } - -- if (FAILURE == phar_verify_signature(fp, end_of_phar, PHAR_SIG_OPENSSL, sig, signature_len, fname, &signature, &sig_len, error)) { -+ if (FAILURE == phar_verify_signature(fp, end_of_phar, sig_flags, sig, signature_len, fname, &signature, &sig_len, error)) { - efree(savebuf); - efree(sig); - php_stream_close(fp); -@@ -3162,7 +3164,9 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv - - php_stream_write(newfile, digest, digest_len); - efree(digest); -- if (phar->sig_flags == PHAR_SIG_OPENSSL) { -+ if (phar->sig_flags == PHAR_SIG_OPENSSL || -+ phar->sig_flags == PHAR_SIG_OPENSSL_SHA256 || -+ phar->sig_flags == PHAR_SIG_OPENSSL_SHA512) { - phar_set_32(sig_buf, digest_len); - php_stream_write(newfile, sig_buf, 4); - } -diff --git a/ext/phar/phar/pharcommand.inc b/ext/phar/phar/pharcommand.inc -index 5f698b4bec26b..1b1eeca59c560 100644 ---- a/ext/phar/phar/pharcommand.inc -+++ b/ext/phar/phar/pharcommand.inc -@@ -92,7 +92,7 @@ class PharCommand extends CLICommand - 'typ' => 'select', - 'val' => NULL, - 'inf' => ' Selects the hash algorithm.', -- 'select' => array('md5' => 'MD5','sha1' => 'SHA1', 'sha256' => 'SHA256', 'sha512' => 'SHA512', 'openssl' => 'OPENSSL') -+ 'select' => ['md5' => 'MD5','sha1' => 'SHA1', 'sha256' => 'SHA256', 'sha512' => 'SHA512', 'openssl' => 'OPENSSL', 'openssl_sha256' => 'OPENSSL_SHA256', 'openssl_sha512' => 'OPENSSL_SHA512'] - ), - 'i' => array( - 'typ' => 'regex', -@@ -156,6 +156,8 @@ class PharCommand extends CLICommand - $hash_avail = Phar::getSupportedSignatures(); - $hash_optional = array('SHA-256' => 'SHA256', - 'SHA-512' => 'SHA512', -+ 'OpenSSL_sha256' => 'OpenSSL_SHA256', -+ 'OpenSSL_sha512' => 'OpenSSL_SHA512', - 'OpenSSL' => 'OpenSSL'); - if (!in_array('OpenSSL', $hash_avail)) { - unset($phar_args['y']); -@@ -429,6 +431,16 @@ class PharCommand extends CLICommand - self::error("Cannot use OpenSSL signing without key.\n"); - } - return Phar::OPENSSL; -+ case 'openssl_sha256': -+ if (!$privkey) { -+ self::error("Cannot use OpenSSL signing without key.\n"); -+ } -+ return Phar::OPENSSL_SHA256; -+ case 'openssl_sha512': -+ if (!$privkey) { -+ self::error("Cannot use OpenSSL signing without key.\n"); -+ } -+ return Phar::OPENSSL_SHA512; - } - } - // }}} -diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h -index a9f81e2ab994a..30b408a8c4462 100644 ---- a/ext/phar/phar_internal.h -+++ b/ext/phar/phar_internal.h -@@ -88,6 +88,8 @@ - #define PHAR_SIG_SHA256 0x0003 - #define PHAR_SIG_SHA512 0x0004 - #define PHAR_SIG_OPENSSL 0x0010 -+#define PHAR_SIG_OPENSSL_SHA256 0x0011 -+#define PHAR_SIG_OPENSSL_SHA512 0x0012 - - /* flags byte for each file adheres to these bitmasks. - All unused values are reserved */ -diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c -index 9c1e5f2fa1eef..c05970e657f18 100644 ---- a/ext/phar/phar_object.c -+++ b/ext/phar/phar_object.c -@@ -1246,9 +1246,13 @@ PHP_METHOD(Phar, getSupportedSignatures) - add_next_index_stringl(return_value, "SHA-512", 7); - #ifdef PHAR_HAVE_OPENSSL - add_next_index_stringl(return_value, "OpenSSL", 7); -+ add_next_index_stringl(return_value, "OpenSSL_SHA256", 14); -+ add_next_index_stringl(return_value, "OpenSSL_SHA512", 14); - #else - if (zend_hash_str_exists(&module_registry, "openssl", sizeof("openssl")-1)) { - add_next_index_stringl(return_value, "OpenSSL", 7); -+ add_next_index_stringl(return_value, "OpenSSL_SHA256", 14); -+ add_next_index_stringl(return_value, "OpenSSL_SHA512", 14); - } - #endif - } -@@ -3028,6 +3032,8 @@ PHP_METHOD(Phar, setSignatureAlgorithm) - case PHAR_SIG_MD5: - case PHAR_SIG_SHA1: - case PHAR_SIG_OPENSSL: -+ case PHAR_SIG_OPENSSL_SHA256: -+ case PHAR_SIG_OPENSSL_SHA512: - if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) { - zend_throw_exception_ex(phar_ce_PharException, 0, "phar \"%s\" is persistent, unable to copy on write", phar_obj->archive->fname); - RETURN_THROWS(); -@@ -3066,19 +3072,25 @@ PHP_METHOD(Phar, getSignature) - add_assoc_stringl(return_value, "hash", phar_obj->archive->signature, phar_obj->archive->sig_len); - switch(phar_obj->archive->sig_flags) { - case PHAR_SIG_MD5: -- add_assoc_stringl(return_value, "hash_type", "MD5", 3); -+ add_assoc_string(return_value, "hash_type", "MD5"); - break; - case PHAR_SIG_SHA1: -- add_assoc_stringl(return_value, "hash_type", "SHA-1", 5); -+ add_assoc_string(return_value, "hash_type", "SHA-1"); - break; - case PHAR_SIG_SHA256: -- add_assoc_stringl(return_value, "hash_type", "SHA-256", 7); -+ add_assoc_string(return_value, "hash_type", "SHA-256"); - break; - case PHAR_SIG_SHA512: -- add_assoc_stringl(return_value, "hash_type", "SHA-512", 7); -+ add_assoc_string(return_value, "hash_type", "SHA-512"); - break; - case PHAR_SIG_OPENSSL: -- add_assoc_stringl(return_value, "hash_type", "OpenSSL", 7); -+ add_assoc_string(return_value, "hash_type", "OpenSSL"); -+ break; -+ case PHAR_SIG_OPENSSL_SHA256: -+ add_assoc_string(return_value, "hash_type", "OpenSSL_SHA256"); -+ break; -+ case PHAR_SIG_OPENSSL_SHA512: -+ add_assoc_string(return_value, "hash_type", "OpenSSL_SHA512"); - break; - default: - unknown = strpprintf(0, "Unknown (%u)", phar_obj->archive->sig_flags); -@@ -5103,6 +5115,8 @@ void phar_object_init(void) /* {{{ */ - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "PHPS", PHAR_MIME_PHPS) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "MD5", PHAR_SIG_MD5) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL", PHAR_SIG_OPENSSL) -+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL_SHA256", PHAR_SIG_OPENSSL_SHA256) -+ REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "OPENSSL_SHA512", PHAR_SIG_OPENSSL_SHA512) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA1", PHAR_SIG_SHA1) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA256", PHAR_SIG_SHA256) - REGISTER_PHAR_CLASS_CONST_LONG(phar_ce_archive, "SHA512", PHAR_SIG_SHA512) -diff --git a/ext/phar/tests/phar_get_supported_signatures_002a.phpt b/ext/phar/tests/phar_get_supported_signatures_002a.phpt -index 06d811f2c35c2..639143b3d2c90 100644 ---- a/ext/phar/tests/phar_get_supported_signatures_002a.phpt -+++ b/ext/phar/tests/phar_get_supported_signatures_002a.phpt -@@ -14,7 +14,7 @@ phar.readonly=0 - var_dump(Phar::getSupportedSignatures()); - ?> - --EXPECT-- --array(5) { -+array(7) { - [0]=> - string(3) "MD5" - [1]=> -@@ -25,4 +25,8 @@ array(5) { - string(7) "SHA-512" - [4]=> - string(7) "OpenSSL" -+ [5]=> -+ string(14) "OpenSSL_SHA256" -+ [6]=> -+ string(14) "OpenSSL_SHA512" - } -diff --git a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -index cc10a241d739b..c2eb5d77a5bf0 100644 ---- a/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -+++ b/ext/phar/tests/tar/phar_setsignaturealgo2.phpt -@@ -38,6 +38,10 @@ $pkey = ''; - openssl_pkey_export($private, $pkey, NULL, $config_arg); - $p->setSignatureAlgorithm(Phar::OPENSSL, $pkey); - var_dump($p->getSignature()); -+$p->setSignatureAlgorithm(Phar::OPENSSL_SHA512, $pkey); -+var_dump($p->getSignature()); -+$p->setSignatureAlgorithm(Phar::OPENSSL_SHA256, $pkey); -+var_dump($p->getSignature()); - } catch (Exception $e) { - echo $e->getMessage(); - } -@@ -83,3 +87,15 @@ array(2) { - ["hash_type"]=> - string(7) "OpenSSL" - } -+array(2) { -+ ["hash"]=> -+ string(%d) "%s" -+ ["hash_type"]=> -+ string(14) "OpenSSL_SHA512" -+} -+array(2) { -+ ["hash"]=> -+ string(%d) "%s" -+ ["hash_type"]=> -+ string(14) "OpenSSL_SHA256" -+} -diff --git a/ext/phar/util.c b/ext/phar/util.c -index 8d2db03b69601..515830bf2c70a 100644 ---- a/ext/phar/util.c -+++ b/ext/phar/util.c -@@ -34,7 +34,7 @@ - #include - #include - #else --static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, size_t key_len, char **signature, size_t *signature_len); -+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, size_t key_len, char **signature, size_t *signature_len, php_uint32 sig_type); - #endif - - /* for links to relative location, prepend cwd of the entry */ -@@ -1381,11 +1381,11 @@ static int phar_hex_str(const char *digest, size_t digest_len, char **signature) - /* }}} */ - - #ifndef PHAR_HAVE_OPENSSL --static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, size_t key_len, char **signature, size_t *signature_len) /* {{{ */ -+static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t end, char *key, size_t key_len, char **signature, size_t *signature_len, php_uint32 sig_type) /* {{{ */ - { - zend_fcall_info fci; - zend_fcall_info_cache fcc; -- zval retval, zp[3], openssl; -+ zval retval, zp[4], openssl; - zend_string *str; - - ZVAL_STRINGL(&openssl, is_sign ? "openssl_sign" : "openssl_verify", is_sign ? sizeof("openssl_sign")-1 : sizeof("openssl_verify")-1); -@@ -1402,6 +1402,14 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t - } else { - ZVAL_EMPTY_STRING(&zp[0]); - } -+ if (sig_type == PHAR_SIG_OPENSSL_SHA512) { -+ ZVAL_LONG(&zp[3], 9); /* value from openssl.c #define OPENSSL_ALGO_SHA512 9 */ -+ } else if (sig_type == PHAR_SIG_OPENSSL_SHA256) { -+ ZVAL_LONG(&zp[3], 7); /* value from openssl.c #define OPENSSL_ALGO_SHA256 7 */ -+ } else { -+ /* don't rely on default value which may change in the future */ -+ ZVAL_LONG(&zp[3], 1); /* value from openssl.c #define OPENSSL_ALGO_SHA1 1 */ -+ } - - if ((size_t)end != Z_STRLEN(zp[0])) { - zval_ptr_dtor_str(&zp[0]); -@@ -1419,7 +1427,7 @@ static int phar_call_openssl_signverify(int is_sign, php_stream *fp, zend_off_t - return FAILURE; - } - -- fci.param_count = 3; -+ fci.param_count = 4; - fci.params = zp; - Z_ADDREF(zp[0]); - if (is_sign) { -@@ -1482,12 +1490,22 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, - php_stream_rewind(fp); - - switch (sig_type) { -+ case PHAR_SIG_OPENSSL_SHA512: -+ case PHAR_SIG_OPENSSL_SHA256: - case PHAR_SIG_OPENSSL: { - #ifdef PHAR_HAVE_OPENSSL - BIO *in; - EVP_PKEY *key; -- EVP_MD *mdtype = (EVP_MD *) EVP_sha1(); -+ const EVP_MD *mdtype; - EVP_MD_CTX *md_ctx; -+ -+ if (sig_type == PHAR_SIG_OPENSSL_SHA512) { -+ mdtype = EVP_sha512(); -+ } else if (sig_type == PHAR_SIG_OPENSSL_SHA256) { -+ mdtype = EVP_sha256(); -+ } else { -+ mdtype = EVP_sha1(); -+ } - #else - size_t tempsig; - #endif -@@ -1521,7 +1539,7 @@ int phar_verify_signature(php_stream *fp, size_t end_of_phar, uint32_t sig_type, - #ifndef PHAR_HAVE_OPENSSL - tempsig = sig_len; - -- if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0, &sig, &tempsig)) { -+ if (FAILURE == phar_call_openssl_signverify(0, fp, end_of_phar, pubkey ? ZSTR_VAL(pubkey) : NULL, pubkey ? ZSTR_LEN(pubkey) : 0, &sig, &tempsig, sig_type)) { - if (pubkey) { - zend_string_release_ex(pubkey, 0); - } -@@ -1815,6 +1833,8 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat - *signature_length = 32; - break; - } -+ case PHAR_SIG_OPENSSL_SHA512: -+ case PHAR_SIG_OPENSSL_SHA256: - case PHAR_SIG_OPENSSL: { - unsigned char *sigbuf; - #ifdef PHAR_HAVE_OPENSSL -@@ -1822,6 +1842,15 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat - BIO *in; - EVP_PKEY *key; - EVP_MD_CTX *md_ctx; -+ const EVP_MD *mdtype; -+ -+ if (phar->sig_flags == PHAR_SIG_OPENSSL_SHA512) { -+ mdtype = EVP_sha512(); -+ } else if (phar->sig_flags == PHAR_SIG_OPENSSL_SHA256) { -+ mdtype = EVP_sha256(); -+ } else { -+ mdtype = EVP_sha1(); -+ } - - in = BIO_new_mem_buf(PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len)); - -@@ -1847,7 +1876,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat - siglen = EVP_PKEY_size(key); - sigbuf = emalloc(siglen + 1); - -- if (!EVP_SignInit(md_ctx, EVP_sha1())) { -+ if (!EVP_SignInit(md_ctx, mdtype)) { - EVP_PKEY_free(key); - efree(sigbuf); - if (error) { -@@ -1885,7 +1914,7 @@ int phar_create_signature(phar_archive_data *phar, php_stream *fp, char **signat - siglen = 0; - php_stream_seek(fp, 0, SEEK_END); - -- if (FAILURE == phar_call_openssl_signverify(1, fp, php_stream_tell(fp), PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len), (char **)&sigbuf, &siglen)) { -+ if (FAILURE == phar_call_openssl_signverify(1, fp, php_stream_tell(fp), PHAR_G(openssl_privatekey), PHAR_G(openssl_privatekey_len), (char **)&sigbuf, &siglen, phar->sig_flags)) { - if (error) { - spprintf(error, 0, "unable to write phar \"%s\" with requested openssl signature", phar->fname); - } diff --git a/php-8.0.10-snmp-sha.patch b/php-8.0.10-snmp-sha.patch deleted file mode 100644 index 3ef67ea..0000000 --- a/php-8.0.10-snmp-sha.patch +++ /dev/null @@ -1,143 +0,0 @@ -Backported for 8.0 from - - -From 718e91343fddb8817a004f96f111c424843bf746 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 11 Aug 2021 13:02:18 +0200 -Subject: [PATCH] add SHA256 and SHA512 for security protocol - ---- - ext/snmp/config.m4 | 18 +++++++++- - ext/snmp/snmp.c | 33 ++++++++++++++++++- - .../tests/snmp-object-setSecurity_error.phpt | 2 +- - ext/snmp/tests/snmp3-error.phpt | 2 +- - 4 files changed, 51 insertions(+), 4 deletions(-) - -diff --git a/ext/snmp/config.m4 b/ext/snmp/config.m4 -index 1475ddfe2b7f0..f285a572de9cb 100644 ---- a/ext/snmp/config.m4 -+++ b/ext/snmp/config.m4 -@@ -30,7 +30,7 @@ if test "$PHP_SNMP" != "no"; then - AC_MSG_ERROR([Could not find the required paths. Please check your net-snmp installation.]) - fi - else -- AC_MSG_ERROR([Net-SNMP version 5.3 or greater reqired (detected $snmp_full_version).]) -+ AC_MSG_ERROR([Net-SNMP version 5.3 or greater required (detected $snmp_full_version).]) - fi - else - AC_MSG_ERROR([Could not find net-snmp-config binary. Please check your net-snmp installation.]) -@@ -54,6 +54,22 @@ if test "$PHP_SNMP" != "no"; then - $SNMP_SHARED_LIBADD - ]) - -+ dnl Check whether usmHMAC192SHA256AuthProtocol exists. -+ PHP_CHECK_LIBRARY($SNMP_LIBNAME, usmHMAC192SHA256AuthProtocol, -+ [ -+ AC_DEFINE(HAVE_SNMP_SHA256, 1, [ ]) -+ ], [], [ -+ $SNMP_SHARED_LIBADD -+ ]) -+ -+ dnl Check whether usmHMAC384SHA512AuthProtocol exists. -+ PHP_CHECK_LIBRARY($SNMP_LIBNAME, usmHMAC384SHA512AuthProtocol, -+ [ -+ AC_DEFINE(HAVE_SNMP_SHA512, 1, [ ]) -+ ], [], [ -+ $SNMP_SHARED_LIBADD -+ ]) -+ - PHP_NEW_EXTENSION(snmp, snmp.c, $ext_shared) - PHP_SUBST(SNMP_SHARED_LIBADD) - fi -diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c -index 69d6549405b17..f0917501751f5 100644 ---- a/ext/snmp/snmp.c -+++ b/ext/snmp/snmp.c -@@ -29,6 +29,7 @@ - #include "php_snmp.h" - - #include "zend_exceptions.h" -+#include "zend_smart_string.h" - #include "ext/spl/spl_exceptions.h" - #include "snmp_arginfo.h" - -@@ -938,16 +939,48 @@ static int netsnmp_session_set_auth_prot - if (!strcasecmp(prot, "MD5")) { - s->securityAuthProto = usmHMACMD5AuthProtocol; - s->securityAuthProtoLen = USM_AUTH_PROTO_MD5_LEN; -- } else -+ return true; -+ } - #endif -+ - if (!strcasecmp(prot, "SHA")) { - s->securityAuthProto = usmHMACSHA1AuthProtocol; - s->securityAuthProtoLen = USM_AUTH_PROTO_SHA_LEN; -- } else { -- zend_value_error("Authentication protocol must be either \"MD5\" or \"SHA\""); -- return (-1); -+ return true; - } -- return (0); -+ -+#ifdef HAVE_SNMP_SHA256 -+ if (!strcasecmp(prot, "SHA256")) { -+ s->securityAuthProto = usmHMAC192SHA256AuthProtocol; -+ s->securityAuthProtoLen = sizeof(usmHMAC192SHA256AuthProtocol) / sizeof(oid); -+ return true; -+ } -+#endif -+ -+#ifdef HAVE_SNMP_SHA512 -+ if (!strcasecmp(prot, "SHA512")) { -+ s->securityAuthProto = usmHMAC384SHA512AuthProtocol; -+ s->securityAuthProtoLen = sizeof(usmHMAC384SHA512AuthProtocol) / sizeof(oid); -+ return true; -+ } -+#endif -+ -+ smart_string err = {0}; -+ -+ smart_string_appends(&err, "Authentication protocol must be \"SHA\""); -+#ifdef HAVE_SNMP_SHA256 -+ smart_string_appends(&err, " or \"SHA256\""); -+#endif -+#ifdef HAVE_SNMP_SHA512 -+ smart_string_appends(&err, " or \"SHA512\""); -+#endif -+#ifndef DISABLE_MD5 -+ smart_string_appends(&err, " or \"MD5\""); -+#endif -+ smart_string_0(&err); -+ zend_value_error("%s", err.c); -+ smart_string_free(&err); -+ return false; - } - /* }}} */ - -diff --git a/ext/snmp/tests/snmp-object-setSecurity_error.phpt b/ext/snmp/tests/snmp-object-setSecurity_error.phpt -index f8de846492a75..cf4f928837773 100644 ---- a/ext/snmp/tests/snmp-object-setSecurity_error.phpt -+++ b/ext/snmp/tests/snmp-object-setSecurity_error.phpt -@@ -59,7 +59,7 @@ var_dump($session->close()); - --EXPECTF-- - Security level must be one of "noAuthNoPriv", "authNoPriv", or "authPriv" - Security level must be one of "noAuthNoPriv", "authNoPriv", or "authPriv" --Authentication protocol must be either "MD5" or "SHA" -+Authentication protocol must be %s - - Warning: SNMP::setSecurity(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d - bool(false) -diff --git a/ext/snmp/tests/snmp3-error.phpt b/ext/snmp/tests/snmp3-error.phpt -index 849e363b45058..389800dad6b28 100644 ---- a/ext/snmp/tests/snmp3-error.phpt -+++ b/ext/snmp/tests/snmp3-error.phpt -@@ -58,7 +58,7 @@ try { - Checking error handling - Security level must be one of "noAuthNoPriv", "authNoPriv", or "authPriv" - Security level must be one of "noAuthNoPriv", "authNoPriv", or "authPriv" --Authentication protocol must be either "MD5" or "SHA" -+Authentication protocol must be %s - - Warning: snmp3_get(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d - bool(false) diff --git a/php-8.0.10-systzdata-v20.patch b/php-8.0.10-systzdata-v20.patch deleted file mode 100644 index 5b0d84b..0000000 --- a/php-8.0.10-systzdata-v20.patch +++ /dev/null @@ -1,660 +0,0 @@ -# License: MIT -# http://opensource.org/licenses/MIT - -Add support for use of the system timezone database, rather -than embedding a copy. Discussed upstream but was not desired. - -History: -r20: adapt for timelib 2020.03 (in 8.0.10RC1) -r19: adapt for timelib 2020.02 (in 8.0.0beta2) -r18: adapt for autotool change in 7.3.3RC1 -r17: adapt for timelib 2018.01 (in 7.3.2RC1) -r16: adapt for timelib 2017.06 (in 7.2.3RC1) -r15: adapt for timelib 2017.05beta7 (in 7.2.0RC1) -r14: improve check for valid tz file -r13: adapt for upstream changes to use PHP allocator -r12: adapt for upstream changes for new zic -r11: use canonical names to avoid more case sensitivity issues - round lat/long from zone.tab towards zero per builtin db -r10: make timezone case insensitive -r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) -r8: fix compile error without --with-system-tzdata configured -r7: improve check for valid timezone id to exclude directories -r6: fix fd leak in r5, fix country code/BC flag use in - timezone_identifiers_list() using system db, - fix use of PECL timezonedb to override system db, -r5: reverts addition of "System/Localtime" fake tzname. - updated for 5.3.0, parses zone.tab to pick up mapping between - timezone name, country code and long/lat coords -r4: added "System/Localtime" tzname which uses /etc/localtime -r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) -r2: add filesystem trawl to set up name alias index -r1: initial revision - -diff -up ./ext/date/config0.m4.systzdata ./ext/date/config0.m4 ---- ./ext/date/config0.m4.systzdata 2021-08-10 11:35:28.000000000 +0200 -+++ ./ext/date/config0.m4 2021-08-10 12:09:41.067003517 +0200 -@@ -4,6 +4,19 @@ AC_CHECK_HEADERS([io.h]) - dnl Check for strtoll, atoll - AC_CHECK_FUNCS(strtoll atoll) - -+PHP_ARG_WITH(system-tzdata, for use of system timezone data, -+[ --with-system-tzdata[=DIR] to specify use of system timezone data], -+no, no) -+ -+if test "$PHP_SYSTEM_TZDATA" != "no"; then -+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) -+ -+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then -+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", -+ [Define for location of system timezone data]) -+ fi -+fi -+ - PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" - timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c - lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c" -diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c ---- ./ext/date/lib/parse_tz.c.systzdata 2021-08-10 11:35:28.000000000 +0200 -+++ ./ext/date/lib/parse_tz.c 2021-08-10 12:12:13.191605207 +0200 -@@ -26,8 +26,21 @@ - #include "timelib.h" - #include "timelib_private.h" - -+#ifdef HAVE_SYSTEM_TZDATA -+#include -+#include -+#include -+#include -+#include -+ -+#include "php_scandir.h" -+ -+#else - #define TIMELIB_SUPPORTS_V2DATA - #include "timezonedb.h" -+#endif -+ -+#include - - #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) - # if defined(__LITTLE_ENDIAN__) -@@ -94,6 +107,11 @@ static int read_php_preamble(const unsig - { - uint32_t version; - -+ if (memcmp(*tzf, "TZif", 4) == 0) { -+ *tzf += 20; -+ return 0; -+ } -+ - /* read ID */ - version = (*tzf)[3] - '0'; - *tzf += 4; -@@ -435,7 +453,429 @@ void timelib_dump_tzinfo(timelib_tzinfo - } - } - --static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb *tzdb) -+#ifdef HAVE_SYSTEM_TZDATA -+ -+#ifdef HAVE_SYSTEM_TZDATA_PREFIX -+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX -+#else -+#define ZONEINFO_PREFIX "/usr/share/zoneinfo" -+#endif -+ -+/* System timezone database pointer. */ -+static const timelib_tzdb *timezonedb_system; -+ -+/* Hash table entry for the cache of the zone.tab mapping table. */ -+struct location_info { -+ char code[2]; -+ double latitude, longitude; -+ char name[64]; -+ char *comment; -+ struct location_info *next; -+}; -+ -+/* Cache of zone.tab. */ -+static struct location_info **system_location_table; -+ -+/* Size of the zone.tab hash table; a random-ish prime big enough to -+ * prevent too many collisions. */ -+#define LOCINFO_HASH_SIZE (1021) -+ -+/* Compute a case insensitive hash of str */ -+static uint32_t tz_hash(const char *str) -+{ -+ const unsigned char *p = (const unsigned char *)str; -+ uint32_t hash = 5381; -+ int c; -+ -+ while ((c = tolower(*p++)) != '\0') { -+ hash = (hash << 5) ^ hash ^ c; -+ } -+ -+ return hash % LOCINFO_HASH_SIZE; -+} -+ -+/* Parse an ISO-6709 date as used in zone.tab. Returns end of the -+ * parsed string on success, or NULL on parse error. On success, -+ * writes the parsed number to *result. */ -+static char *parse_iso6709(char *p, double *result) -+{ -+ double v, sign; -+ char *pend; -+ size_t len; -+ -+ if (*p == '+') -+ sign = 1.0; -+ else if (*p == '-') -+ sign = -1.0; -+ else -+ return NULL; -+ -+ p++; -+ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) -+ ;; -+ -+ /* Annoying encoding used by zone.tab has no decimal point, so use -+ * the length to determine the format: -+ * -+ * 4 = DDMM -+ * 5 = DDDMM -+ * 6 = DDMMSS -+ * 7 = DDDMMSS -+ */ -+ len = pend - p; -+ if (len < 4 || len > 7) { -+ return NULL; -+ } -+ -+ /* p => [D]DD */ -+ v = (p[0] - '0') * 10.0 + (p[1] - '0'); -+ p += 2; -+ if (len == 5 || len == 7) -+ v = v * 10.0 + (*p++ - '0'); -+ /* p => MM[SS] */ -+ v += (10.0 * (p[0] - '0') -+ + p[1] - '0') / 60.0; -+ p += 2; -+ /* p => [SS] */ -+ if (len > 5) { -+ v += (10.0 * (p[0] - '0') -+ + p[1] - '0') / 3600.0; -+ p += 2; -+ } -+ -+ /* Round to five decimal place, not because it's a good idea, -+ * but, because the builtin data uses rounded data, so, match -+ * that. */ -+ *result = trunc(v * sign * 100000.0) / 100000.0; -+ -+ return p; -+} -+ -+/* This function parses the zone.tab file to build up the mapping of -+ * timezone to country code and geographic location, and returns a -+ * hash table. The hash table is indexed by the function: -+ * -+ * tz_hash(timezone-name) -+ */ -+static struct location_info **create_location_table(void) -+{ -+ struct location_info **li, *i; -+ char zone_tab[PATH_MAX]; -+ char line[512]; -+ FILE *fp; -+ -+ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); -+ -+ fp = fopen(zone_tab, "r"); -+ if (!fp) { -+ return NULL; -+ } -+ -+ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); -+ -+ while (fgets(line, sizeof line, fp)) { -+ char *p = line, *code, *name, *comment; -+ uint32_t hash; -+ double latitude, longitude; -+ -+ while (isspace(*p)) -+ p++; -+ -+ if (*p == '#' || *p == '\0' || *p == '\n') -+ continue; -+ -+ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') -+ continue; -+ -+ /* code => AA */ -+ code = p; -+ p[2] = 0; -+ p += 3; -+ -+ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ -+ p = parse_iso6709(p, &latitude); -+ if (!p) { -+ continue; -+ } -+ p = parse_iso6709(p, &longitude); -+ if (!p) { -+ continue; -+ } -+ -+ if (!p || *p != '\t') { -+ continue; -+ } -+ -+ /* name = string */ -+ name = ++p; -+ while (*p != '\t' && *p && *p != '\n') -+ p++; -+ -+ *p++ = '\0'; -+ -+ /* comment = string */ -+ comment = p; -+ while (*p != '\t' && *p && *p != '\n') -+ p++; -+ -+ if (*p == '\n' || *p == '\t') -+ *p = '\0'; -+ -+ hash = tz_hash(name); -+ i = malloc(sizeof *i); -+ memcpy(i->code, code, 2); -+ strncpy(i->name, name, sizeof i->name); -+ i->comment = strdup(comment); -+ i->longitude = longitude; -+ i->latitude = latitude; -+ i->next = li[hash]; -+ li[hash] = i; -+ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ -+ } -+ -+ fclose(fp); -+ -+ return li; -+} -+ -+/* Return location info from hash table, using given timezone name. -+ * Returns NULL if the name could not be found. */ -+const struct location_info *find_zone_info(struct location_info **li, -+ const char *name) -+{ -+ uint32_t hash = tz_hash(name); -+ const struct location_info *l; -+ -+ if (!li) { -+ return NULL; -+ } -+ -+ for (l = li[hash]; l; l = l->next) { -+ if (timelib_strcasecmp(l->name, name) == 0) -+ return l; -+ } -+ -+ return NULL; -+} -+ -+/* Filter out some non-tzdata files and the posix/right databases, if -+ * present. */ -+static int index_filter(const struct dirent *ent) -+{ -+ return strcmp(ent->d_name, ".") != 0 -+ && strcmp(ent->d_name, "..") != 0 -+ && strcmp(ent->d_name, "posix") != 0 -+ && strcmp(ent->d_name, "posixrules") != 0 -+ && strcmp(ent->d_name, "right") != 0 -+ && strstr(ent->d_name, ".list") == NULL -+ && strstr(ent->d_name, ".tab") == NULL; -+} -+ -+static int sysdbcmp(const void *first, const void *second) -+{ -+ const timelib_tzdb_index_entry *alpha = first, *beta = second; -+ -+ return timelib_strcasecmp(alpha->id, beta->id); -+} -+ -+ -+/* Create the zone identifier index by trawling the filesystem. */ -+static void create_zone_index(timelib_tzdb *db) -+{ -+ size_t dirstack_size, dirstack_top; -+ size_t index_size, index_next; -+ timelib_tzdb_index_entry *db_index; -+ char **dirstack; -+ -+ /* LIFO stack to hold directory entries to scan; each slot is a -+ * directory name relative to the zoneinfo prefix. */ -+ dirstack_size = 32; -+ dirstack = malloc(dirstack_size * sizeof *dirstack); -+ dirstack_top = 1; -+ dirstack[0] = strdup(""); -+ -+ /* Index array. */ -+ index_size = 64; -+ db_index = malloc(index_size * sizeof *db_index); -+ index_next = 0; -+ -+ do { -+ struct dirent **ents; -+ char name[PATH_MAX], *top; -+ int count; -+ -+ /* Pop the top stack entry, and iterate through its contents. */ -+ top = dirstack[--dirstack_top]; -+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); -+ -+ count = php_scandir(name, &ents, index_filter, php_alphasort); -+ -+ while (count > 0) { -+ struct stat st; -+ const char *leaf = ents[count - 1]->d_name; -+ -+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", -+ top, leaf); -+ -+ if (strlen(name) && stat(name, &st) == 0) { -+ /* Name, relative to the zoneinfo prefix. */ -+ const char *root = top; -+ -+ if (root[0] == '/') root++; -+ -+ snprintf(name, sizeof name, "%s%s%s", root, -+ *root ? "/": "", leaf); -+ -+ if (S_ISDIR(st.st_mode)) { -+ if (dirstack_top == dirstack_size) { -+ dirstack_size *= 2; -+ dirstack = realloc(dirstack, -+ dirstack_size * sizeof *dirstack); -+ } -+ dirstack[dirstack_top++] = strdup(name); -+ } -+ else { -+ if (index_next == index_size) { -+ index_size *= 2; -+ db_index = realloc(db_index, -+ index_size * sizeof *db_index); -+ } -+ -+ db_index[index_next++].id = strdup(name); -+ } -+ } -+ -+ free(ents[--count]); -+ } -+ -+ if (count != -1) free(ents); -+ free(top); -+ } while (dirstack_top); -+ -+ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); -+ -+ db->index = db_index; -+ db->index_size = index_next; -+ -+ free(dirstack); -+} -+ -+#define FAKE_HEADER "1234\0??\1??" -+#define FAKE_UTC_POS (7 - 4) -+ -+/* Create a fake data segment for database 'sysdb'. */ -+static void fake_data_segment(timelib_tzdb *sysdb, -+ struct location_info **info) -+{ -+ size_t n; -+ char *data, *p; -+ -+ data = malloc(3 * sysdb->index_size + 7); -+ -+ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); -+ -+ for (n = 0; n < sysdb->index_size; n++) { -+ const struct location_info *li; -+ timelib_tzdb_index_entry *ent; -+ -+ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; -+ -+ /* Lookup the timezone name in the hash table. */ -+ if (strcmp(ent->id, "UTC") == 0) { -+ ent->pos = FAKE_UTC_POS; -+ continue; -+ } -+ -+ li = find_zone_info(info, ent->id); -+ if (li) { -+ /* If found, append the BC byte and the -+ * country code; set the position for this -+ * section of timezone data. */ -+ ent->pos = (p - data) - 4; -+ *p++ = '\1'; -+ *p++ = li->code[0]; -+ *p++ = li->code[1]; -+ } -+ else { -+ /* If not found, the timezone data can -+ * point at the header. */ -+ ent->pos = 0; -+ } -+ } -+ -+ sysdb->data = (unsigned char *)data; -+} -+ -+/* Returns true if the passed-in stat structure describes a -+ * probably-valid timezone file. */ -+static int is_valid_tzfile(const struct stat *st, int fd) -+{ -+ if (fd) { -+ char buf[20]; -+ if (read(fd, buf, 20)!=20) { -+ return 0; -+ } -+ lseek(fd, SEEK_SET, 0); -+ if (memcmp(buf, "TZif", 4)) { -+ return 0; -+ } -+ } -+ return S_ISREG(st->st_mode) && st->st_size > 20; -+} -+ -+/* To allow timezone names to be used case-insensitively, find the -+ * canonical name for this timezone, if possible. */ -+static const char *canonical_tzname(const char *timezone) -+{ -+ if (timezonedb_system) { -+ timelib_tzdb_index_entry *ent, lookup; -+ -+ lookup.id = (char *)timezone; -+ -+ ent = bsearch(&lookup, timezonedb_system->index, -+ timezonedb_system->index_size, sizeof lookup, -+ sysdbcmp); -+ if (ent) { -+ return ent->id; -+ } -+ } -+ -+ return timezone; -+} -+ -+/* Return the mmap()ed tzfile if found, else NULL. On success, the -+ * length of the mapped data is placed in *length. */ -+static char *map_tzfile(const char *timezone, size_t *length) -+{ -+ char fname[PATH_MAX]; -+ struct stat st; -+ char *p; -+ int fd; -+ -+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { -+ return NULL; -+ } -+ -+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); -+ -+ fd = open(fname, O_RDONLY); -+ if (fd == -1) { -+ return NULL; -+ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) { -+ close(fd); -+ return NULL; -+ } -+ -+ *length = st.st_size; -+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); -+ close(fd); -+ -+ return p != MAP_FAILED ? p : NULL; -+} -+ -+#endif -+ -+static int inmem_seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb *tzdb) - { - int left = 0, right = tzdb->index_size - 1; - -@@ -461,9 +901,48 @@ static int seek_to_tz_position(const uns - return 0; - } - -+static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, -+ char **map, size_t *maplen, -+ const timelib_tzdb *tzdb) -+{ -+#ifdef HAVE_SYSTEM_TZDATA -+ if (tzdb == timezonedb_system) { -+ char *orig; -+ -+ orig = map_tzfile(timezone, maplen); -+ if (orig == NULL) { -+ return 0; -+ } -+ -+ (*tzf) = (unsigned char *)orig; -+ *map = orig; -+ return 1; -+ } -+ else -+#endif -+ { -+ return inmem_seek_to_tz_position(tzf, timezone, tzdb); -+ } -+} -+ - const timelib_tzdb *timelib_builtin_db(void) - { -+#ifdef HAVE_SYSTEM_TZDATA -+ if (timezonedb_system == NULL) { -+ timelib_tzdb *tmp = malloc(sizeof *tmp); -+ -+ tmp->version = "0.system"; -+ tmp->data = NULL; -+ create_zone_index(tmp); -+ system_location_table = create_location_table(); -+ fake_data_segment(tmp, system_location_table); -+ timezonedb_system = tmp; -+ } -+ -+ return timezonedb_system; -+#else - return &timezonedb_builtin; -+#endif - } - - const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count) -@@ -475,7 +954,30 @@ const timelib_tzdb_index_entry *timelib_ - int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb) - { - const unsigned char *tzf; -- return (seek_to_tz_position(&tzf, timezone, tzdb)); -+ -+#ifdef HAVE_SYSTEM_TZDATA -+ if (tzdb == timezonedb_system) { -+ char fname[PATH_MAX]; -+ struct stat st; -+ -+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { -+ return 0; -+ } -+ -+ if (system_location_table) { -+ if (find_zone_info(system_location_table, timezone) != NULL) { -+ /* found in cache */ -+ return 1; -+ } -+ } -+ -+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); -+ -+ return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0); -+ } -+#endif -+ -+ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); - } - - static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) -@@ -517,6 +1019,8 @@ static timelib_tzinfo* timelib_tzinfo_ct - timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *tzdb, int *error_code) - { - const unsigned char *tzf; -+ char *memmap = NULL; -+ size_t maplen; - timelib_tzinfo *tmp; - int version; - int transitions_result, types_result; -@@ -524,7 +1028,7 @@ timelib_tzinfo *timelib_parse_tzfile(con - - *error_code = TIMELIB_ERROR_NO_ERROR; - -- if (seek_to_tz_position(&tzf, timezone, tzdb)) { -+ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { - tmp = timelib_tzinfo_ctor(timezone); - - version = read_preamble(&tzf, tmp, &type); -@@ -563,11 +1067,36 @@ timelib_tzinfo *timelib_parse_tzfile(con - } - skip_posix_string(&tzf, tmp); - -+#ifdef HAVE_SYSTEM_TZDATA -+ if (memmap) { -+ const struct location_info *li; -+ -+ /* TZif-style - grok the location info from the system database, -+ * if possible. */ -+ -+ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { -+ tmp->location.comments = timelib_strdup(li->comment); -+ strncpy(tmp->location.country_code, li->code, 2); -+ tmp->location.longitude = li->longitude; -+ tmp->location.latitude = li->latitude; -+ tmp->bc = 1; -+ } -+ else { -+ set_default_location_and_comments(&tzf, tmp); -+ } -+ -+ /* Now done with the mmap segment - discard it. */ -+ munmap(memmap, maplen); -+ } else { -+#endif - if (type == TIMELIB_TZINFO_PHP) { - read_location(&tzf, tmp); - } else { - set_default_location_and_comments(&tzf, tmp); - } -+#ifdef HAVE_SYSTEM_TZDATA -+ } -+#endif - } else { - *error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE; - tmp = NULL; diff --git a/php-8.0.6-deprecated.patch b/php-8.0.6-deprecated.patch deleted file mode 100644 index 1e6b93b..0000000 --- a/php-8.0.6-deprecated.patch +++ /dev/null @@ -1,400 +0,0 @@ -From 4dc8b3c0efaae25b08c8f59b068f17c97c59d0ae Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 5 May 2021 15:41:00 +0200 -Subject: [PATCH] get rid of inet_aton and inet_ntoa use inet_ntop iand - inet_pton where available standardize buffer size - ---- - ext/sockets/sockaddr_conv.c | 4 ++++ - ext/sockets/sockets.c | 48 +++++++++++++++++++++++++------------ - ext/standard/dns.c | 16 ++++++++++++- - main/network.c | 20 ++++++++++++++-- - 4 files changed, 70 insertions(+), 18 deletions(-) - -diff --git a/ext/sockets/sockaddr_conv.c b/ext/sockets/sockaddr_conv.c -index 57996612d2d7e..65c8418fb3a6f 100644 ---- a/ext/sockets/sockaddr_conv.c -+++ b/ext/sockets/sockaddr_conv.c -@@ -87,7 +87,11 @@ int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *php_soc - struct in_addr tmp; - struct hostent *host_entry; - -+#ifdef HAVE_INET_PTON -+ if (inet_pton(AF_INET, string, &tmp)) { -+#else - if (inet_aton(string, &tmp)) { -+#endif - sin->sin_addr.s_addr = tmp.s_addr; - } else { - if (strlen(string) > MAXFQDNLEN || ! (host_entry = php_network_gethostbyname(string))) { -diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c -index 16ad3e8013a4c..85c938d1b97b1 100644 ---- a/ext/sockets/sockets.c -+++ b/ext/sockets/sockets.c -@@ -220,8 +220,10 @@ zend_module_entry sockets_module_entry = { - ZEND_GET_MODULE(sockets) - #endif - -+#ifndef HAVE_INET_NTOP - /* inet_ntop should be used instead of inet_ntoa */ - int inet_ntoa_lock = 0; -+#endif - - static int php_open_listen_sock(php_socket *sock, int port, int backlog) /* {{{ */ - { -@@ -1082,10 +1084,12 @@ PHP_FUNCTION(socket_getsockname) - struct sockaddr_in *sin; - #if HAVE_IPV6 - struct sockaddr_in6 *sin6; -- char addr6[INET6_ADDRSTRLEN+1]; -+#endif -+#ifdef HAVE_INET_NTOP -+ char addrbuf[INET6_ADDRSTRLEN]; - #endif - struct sockaddr_un *s_un; -- char *addr_string; -+ const char *addr_string; - socklen_t salen = sizeof(php_sockaddr_storage); - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz|z", &arg1, socket_ce, &addr, &port) == FAILURE) { -@@ -1106,8 +1110,8 @@ PHP_FUNCTION(socket_getsockname) - #if HAVE_IPV6 - case AF_INET6: - sin6 = (struct sockaddr_in6 *) sa; -- inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN); -- ZEND_TRY_ASSIGN_REF_STRING(addr, addr6); -+ inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf)); -+ ZEND_TRY_ASSIGN_REF_STRING(addr, addrbuf); - - if (port != NULL) { - ZEND_TRY_ASSIGN_REF_LONG(port, htons(sin6->sin6_port)); -@@ -1117,11 +1121,14 @@ PHP_FUNCTION(socket_getsockname) - #endif - case AF_INET: - sin = (struct sockaddr_in *) sa; -+#ifdef HAVE_INET_NTOP -+ addr_string = inet_ntop(AF_INET, &sin->sin_addr, addrbuf, sizeof(addrbuf)); -+#else - while (inet_ntoa_lock == 1); - inet_ntoa_lock = 1; - addr_string = inet_ntoa(sin->sin_addr); - inet_ntoa_lock = 0; -- -+#endif - ZEND_TRY_ASSIGN_REF_STRING(addr, addr_string); - - if (port != NULL) { -@@ -1154,10 +1161,12 @@ PHP_FUNCTION(socket_getpeername) - struct sockaddr_in *sin; - #if HAVE_IPV6 - struct sockaddr_in6 *sin6; -- char addr6[INET6_ADDRSTRLEN+1]; -+#endif -+#ifdef HAVE_INET_NTOP -+ char addrbuf[INET6_ADDRSTRLEN]; - #endif - struct sockaddr_un *s_un; -- char *addr_string; -+ const char *addr_string; - socklen_t salen = sizeof(php_sockaddr_storage); - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Oz|z", &arg1, socket_ce, &arg2, &arg3) == FAILURE) { -@@ -1178,9 +1187,9 @@ PHP_FUNCTION(socket_getpeername) - #if HAVE_IPV6 - case AF_INET6: - sin6 = (struct sockaddr_in6 *) sa; -- inet_ntop(AF_INET6, &sin6->sin6_addr, addr6, INET6_ADDRSTRLEN); -+ inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf)); - -- ZEND_TRY_ASSIGN_REF_STRING(arg2, addr6); -+ ZEND_TRY_ASSIGN_REF_STRING(arg2, addrbuf); - - if (arg3 != NULL) { - ZEND_TRY_ASSIGN_REF_LONG(arg3, htons(sin6->sin6_port)); -@@ -1191,11 +1200,14 @@ PHP_FUNCTION(socket_getpeername) - #endif - case AF_INET: - sin = (struct sockaddr_in *) sa; -+#ifdef HAVE_INET_NTOP -+ addr_string = inet_ntop(AF_INET, &sin->sin_addr, addrbuf, sizeof(addrbuf)); -+#else - while (inet_ntoa_lock == 1); - inet_ntoa_lock = 1; - addr_string = inet_ntoa(sin->sin_addr); - inet_ntoa_lock = 0; -- -+#endif - ZEND_TRY_ASSIGN_REF_STRING(arg2, addr_string); - - if (arg3 != NULL) { -@@ -1527,12 +1539,14 @@ PHP_FUNCTION(socket_recvfrom) - struct sockaddr_in sin; - #if HAVE_IPV6 - struct sockaddr_in6 sin6; -- char addr6[INET6_ADDRSTRLEN]; -+#endif -+#ifdef HAVE_INET_NTOP -+ char addrbuf[INET6_ADDRSTRLEN]; - #endif - socklen_t slen; - int retval; - zend_long arg3, arg4; -- char *address; -+ const char *address; - zend_string *recv_buf; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ozllz|z", &arg1, socket_ce, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE) { -@@ -1590,7 +1604,11 @@ PHP_FUNCTION(socket_recvfrom) - ZSTR_LEN(recv_buf) = retval; - ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0'; - -+#ifdef HAVE_INET_NTOP -+ address = inet_ntop(AF_INET, &sin.sin_addr, addrbuf, sizeof(addrbuf)); -+#else - address = inet_ntoa(sin.sin_addr); -+#endif - - ZEND_TRY_ASSIGN_REF_NEW_STR(arg2, recv_buf); - ZEND_TRY_ASSIGN_REF_STRING(arg5, address ? address : "0.0.0.0"); -@@ -1617,11 +1635,11 @@ PHP_FUNCTION(socket_recvfrom) - ZSTR_LEN(recv_buf) = retval; - ZSTR_VAL(recv_buf)[ZSTR_LEN(recv_buf)] = '\0'; - -- memset(addr6, 0, INET6_ADDRSTRLEN); -- inet_ntop(AF_INET6, &sin6.sin6_addr, addr6, INET6_ADDRSTRLEN); -+ memset(addrbuf, 0, INET6_ADDRSTRLEN); -+ inet_ntop(AF_INET6, &sin6.sin6_addr, addrbuf, sizeof(addrbuf)); - - ZEND_TRY_ASSIGN_REF_NEW_STR(arg2, recv_buf); -- ZEND_TRY_ASSIGN_REF_STRING(arg5, addr6[0] ? addr6 : "::"); -+ ZEND_TRY_ASSIGN_REF_STRING(arg5, addrbuf[0] ? addrbuf : "::"); - ZEND_TRY_ASSIGN_REF_LONG(arg6, ntohs(sin6.sin6_port)); - break; - #endif -diff --git a/ext/standard/dns.c b/ext/standard/dns.c -index 41b98424edb60..6efdbbe894b46 100644 ---- a/ext/standard/dns.c -+++ b/ext/standard/dns.c -@@ -228,6 +228,9 @@ PHP_FUNCTION(gethostbynamel) - struct hostent *hp; - struct in_addr in; - int i; -+#ifdef HAVE_INET_NTOP -+ char addr4[INET_ADDRSTRLEN]; -+#endif - - ZEND_PARSE_PARAMETERS_START(1, 1) - Z_PARAM_PATH(hostname, hostname_len) -@@ -255,7 +258,11 @@ PHP_FUNCTION(gethostbynamel) - } - - in = *h_addr_entry; -+#ifdef HAVE_INET_NTOP -+ add_next_index_string(return_value, inet_ntop(AF_INET, &in, addr4, INET_ADDRSTRLEN)); -+#else - add_next_index_string(return_value, inet_ntoa(in)); -+#endif - } - } - /* }}} */ -@@ -266,7 +273,10 @@ static zend_string *php_gethostbyname(char *name) - struct hostent *hp; - struct in_addr *h_addr_0; /* Don't call this h_addr, it's a macro! */ - struct in_addr in; -- char *address; -+#ifdef HAVE_INET_NTOP -+ char addr4[INET_ADDRSTRLEN]; -+#endif -+ const char *address; - - hp = php_network_gethostbyname(name); - if (!hp) { -@@ -281,7 +291,11 @@ static zend_string *php_gethostbyname(char *name) - - memcpy(&in.s_addr, h_addr_0, sizeof(in.s_addr)); - -+#ifdef HAVE_INET_NTOP -+ address = inet_ntop(AF_INET, &in, addr4, INET_ADDRSTRLEN); -+#else - address = inet_ntoa(in); -+#endif - return zend_string_init(address, strlen(address), 0); - } - /* }}} */ -diff --git a/main/network.c b/main/network.c -index 2c504952b2dd1..7f2f714ec42df 100644 ---- a/main/network.c -+++ b/main/network.c -@@ -236,8 +236,12 @@ PHPAPI int php_network_getaddresses(const char *host, int socktype, struct socka - } while ((sai = sai->ai_next) != NULL); - - freeaddrinfo(res); -+#else -+#ifdef HAVE_INET_PTON -+ if (!inet_pton(AF_INET, host, &in)) { - #else - if (!inet_aton(host, &in)) { -+#endif - if(strlen(host) > MAXFQDNLEN) { - host_info = NULL; - errno = E2BIG; -@@ -555,7 +559,11 @@ PHPAPI int php_network_parse_network_address_with_port(const char *addr, zend_lo - goto out; - } - #endif -+#ifdef HAVE_INET_PTON -+ if (inet_pton(AF_INET, tmp, &in4->sin_addr) > 0) { -+#else - if (inet_aton(tmp, &in4->sin_addr) > 0) { -+#endif - in4->sin_port = htons(port); - in4->sin_family = AF_INET; - *sl = sizeof(struct sockaddr_in); -@@ -617,15 +625,19 @@ PHPAPI void php_network_populate_name_from_sockaddr( - } - - if (textaddr) { --#if HAVE_IPV6 && HAVE_INET_NTOP -+#ifdef HAVE_INET_NTOP - char abuf[256]; - #endif -- char *buf = NULL; -+ const char *buf = NULL; - - switch (sa->sa_family) { - case AF_INET: - /* generally not thread safe, but it *is* thread safe under win32 */ -+#ifdef HAVE_INET_NTOP -+ buf = inet_ntop(AF_INET, &((struct sockaddr_in*)sa)->sin_addr, (char *)&abuf, sizeof(abuf)); -+#else - buf = inet_ntoa(((struct sockaddr_in*)sa)->sin_addr); -+#endif - if (buf) { - *textaddr = strpprintf(0, "%s:%d", - buf, ntohs(((struct sockaddr_in*)sa)->sin_port)); -@@ -862,7 +874,11 @@ php_socket_t php_network_connect_socket_to_host(const char *host, unsigned short - - in4->sin_family = sa->sa_family; - in4->sin_port = htons(bindport); -+#ifdef HAVE_INET_PTON -+ if (!inet_pton(AF_INET, bindto, &in4->sin_addr)) { -+#else - if (!inet_aton(bindto, &in4->sin_addr)) { -+#endif - php_error_docref(NULL, E_WARNING, "Invalid IP Address: %s", bindto); - goto skip_bind; - } -From e5b6f43ec7813392d83ea586b7902e0396a1f792 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 6 May 2021 14:21:29 +0200 -Subject: [PATCH] get rid of inet_addr usage - ---- - main/fastcgi.c | 4 ++++ - sapi/litespeed/lsapilib.c | 4 ++++ - 2 files changed, 8 insertions(+) - -diff --git a/main/fastcgi.c b/main/fastcgi.c -index 071f69d3a7f0..c936d42405de 100644 ---- a/main/fastcgi.c -+++ b/main/fastcgi.c -@@ -688,8 +688,12 @@ int fcgi_listen(const char *path, int backlog) - if (!*host || !strncmp(host, "*", sizeof("*")-1)) { - sa.sa_inet.sin_addr.s_addr = htonl(INADDR_ANY); - } else { -+#ifdef HAVE_INET_PTON -+ if (!inet_pton(AF_INET, host, &sa.sa_inet.sin_addr)) { -+#else - sa.sa_inet.sin_addr.s_addr = inet_addr(host); - if (sa.sa_inet.sin_addr.s_addr == INADDR_NONE) { -+#endif - struct hostent *hep; - - if(strlen(host) > MAXFQDNLEN) { -diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c -index a72b5dc1b988..305f3326a682 100644 ---- a/sapi/litespeed/lsapilib.c -+++ b/sapi/litespeed/lsapilib.c -@@ -2672,8 +2672,12 @@ int LSAPI_ParseSockAddr( const char * pBind, struct sockaddr * pAddr ) - ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = htonl( INADDR_LOOPBACK ); - else - { -+#ifdef HAVE_INET_PTON -+ if (!inet_pton(AF_INET, p, &((struct sockaddr_in *)pAddr)->sin_addr)) -+#else - ((struct sockaddr_in *)pAddr)->sin_addr.s_addr = inet_addr( p ); - if ( ((struct sockaddr_in *)pAddr)->sin_addr.s_addr == INADDR_BROADCAST) -+#endif - { - doAddrInfo = 1; - } -From 99d67d121acd4c324738509679d23acaf759d065 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 6 May 2021 16:35:48 +0200 -Subject: [PATCH] use getnameinfo instead of gethostbyaddr - ---- - ext/standard/dns.c | 34 ++++++++++++++++++++++------------ - 1 file changed, 22 insertions(+), 12 deletions(-) - -diff --git a/ext/standard/dns.c b/ext/standard/dns.c -index edd9a4549f5c..540c777faaba 100644 ---- a/ext/standard/dns.c -+++ b/ext/standard/dns.c -@@ -169,20 +169,30 @@ PHP_FUNCTION(gethostbyaddr) - static zend_string *php_gethostbyaddr(char *ip) - { - #if HAVE_IPV6 && HAVE_INET_PTON -- struct in6_addr addr6; --#endif -- struct in_addr addr; -- struct hostent *hp; -+ struct sockaddr_in sa4; -+ struct sockaddr_in6 sa6; -+ char out[NI_MAXHOST]; - --#if HAVE_IPV6 && HAVE_INET_PTON -- if (inet_pton(AF_INET6, ip, &addr6)) { -- hp = gethostbyaddr((char *) &addr6, sizeof(addr6), AF_INET6); -- } else if (inet_pton(AF_INET, ip, &addr)) { -- hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); -- } else { -- return NULL; -+ if (inet_pton(AF_INET6, ip, &sa6.sin6_addr)) { -+ sa6.sin6_family = AF_INET6; -+ -+ if (getnameinfo((struct sockaddr *)&sa6, sizeof(sa6), out, sizeof(out), NULL, 0, NI_NAMEREQD) < 0) { -+ return zend_string_init(ip, strlen(ip), 0); -+ } -+ return zend_string_init(out, strlen(out), 0); -+ } else if (inet_pton(AF_INET, ip, &sa4.sin_addr)) { -+ sa4.sin_family = AF_INET; -+ -+ if (getnameinfo((struct sockaddr *)&sa4, sizeof(sa4), out, sizeof(out), NULL, 0, NI_NAMEREQD) < 0) { -+ return zend_string_init(ip, strlen(ip), 0); -+ } -+ return zend_string_init(out, strlen(out), 0); - } -+ return NULL; /* not a valid IP */ - #else -+ struct in_addr addr; -+ struct hostent *hp; -+ - addr.s_addr = inet_addr(ip); - - if (addr.s_addr == -1) { -@@ -190,13 +200,13 @@ static zend_string *php_gethostbyaddr(char *ip) - } - - hp = gethostbyaddr((char *) &addr, sizeof(addr), AF_INET); --#endif - - if (!hp || hp->h_name == NULL || hp->h_name[0] == '\0') { - return zend_string_init(ip, strlen(ip), 0); - } - - return zend_string_init(hp->h_name, strlen(hp->h_name), 0); -+#endif - } - /* }}} */ - diff --git a/php-8.1.0-libdb.patch b/php-8.1.0-libdb.patch new file mode 100644 index 0000000..7a2a097 --- /dev/null +++ b/php-8.1.0-libdb.patch @@ -0,0 +1,92 @@ +diff -up ./ext/dba/config.m4.libdb ./ext/dba/config.m4 +--- ./ext/dba/config.m4.libdb 2020-04-09 14:06:11.000000000 +0200 ++++ ./ext/dba/config.m4 2020-04-09 14:35:08.208605065 +0200 +@@ -375,61 +375,13 @@ if test "$PHP_DB4" != "no"; then + dbdp4="/usr/local/BerkeleyDB.4." + dbdp5="/usr/local/BerkeleyDB.5." + for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do +- if test -f "$i/db5/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/db5/db.h +- break +- elif test -f "$i/db4/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/db4/db.h +- break +- elif test -f "$i/include/db5.3/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db5.3/db.h +- break +- elif test -f "$i/include/db5.1/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db5.1/db.h +- break +- elif test -f "$i/include/db5.0/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db5.0/db.h +- break +- elif test -f "$i/include/db4.8/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.8/db.h +- break +- elif test -f "$i/include/db4.7/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.7/db.h +- break +- elif test -f "$i/include/db4.6/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.6/db.h +- break +- elif test -f "$i/include/db4.5/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.5/db.h +- break +- elif test -f "$i/include/db4/db.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4/db.h +- break +- elif test -f "$i/include/db/db4.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db/db4.h +- break +- elif test -f "$i/include/db4.h"; then +- THIS_PREFIX=$i +- THIS_INCLUDE=$i/include/db4.h +- break +- elif test -f "$i/include/db.h"; then ++ if test -f "$i/include/db.h"; then + THIS_PREFIX=$i + THIS_INCLUDE=$i/include/db.h + break + fi + done +- PHP_DBA_DB_CHECK(4, db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) ++ PHP_DBA_DB_CHECK(4, db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)]) + fi + PHP_DBA_STD_RESULT(db4,Berkeley DB4) + +diff -up ./ext/dba/dba.c.libdb ./ext/dba/dba.c +--- ./ext/dba/dba.c.libdb 2020-04-09 14:06:11.000000000 +0200 ++++ ./ext/dba/dba.c 2020-04-09 14:36:30.593275190 +0200 +@@ -50,6 +50,10 @@ + #include "php_lmdb.h" + #include "dba_arginfo.h" + ++#ifdef DB4_INCLUDE_FILE ++#include DB4_INCLUDE_FILE ++#endif ++ + PHP_MINIT_FUNCTION(dba); + PHP_MSHUTDOWN_FUNCTION(dba); + PHP_MINFO_FUNCTION(dba); +@@ -452,6 +456,10 @@ PHP_MINFO_FUNCTION(dba) + + php_info_print_table_start(); + php_info_print_table_row(2, "DBA support", "enabled"); ++#ifdef DB_VERSION_STRING ++ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); ++ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); ++#endif + if (handlers.s) { + smart_str_0(&handlers); + php_info_print_table_row(2, "Supported handlers", ZSTR_VAL(handlers.s)); diff --git a/php-8.1.0-phpinfo.patch b/php-8.1.0-phpinfo.patch new file mode 100644 index 0000000..d19b2f4 --- /dev/null +++ b/php-8.1.0-phpinfo.patch @@ -0,0 +1,44 @@ + +Drop "Configure Command" from phpinfo as it doesn't +provide any useful information. +The available extensions are not related to this command. + +Replace full GCC name by gcc in php -v output + + +diff -up ./ext/standard/info.c.phpinfo ./ext/standard/info.c +--- ./ext/standard/info.c.phpinfo 2020-07-21 10:49:31.000000000 +0200 ++++ ./ext/standard/info.c 2020-07-21 11:41:56.295633523 +0200 +@@ -805,9 +805,6 @@ PHPAPI ZEND_COLD void php_print_info(int + #ifdef PHP_BUILD_ARCH + php_info_print_table_row(2, "Architecture", PHP_BUILD_ARCH); + #endif +-#ifdef CONFIGURE_COMMAND +- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); +-#endif + + if (sapi_module.pretty_name) { + php_info_print_table_row(2, "Server API", sapi_module.pretty_name ); +diff -up ./ext/standard/tests/general_functions/phpinfo.phpt.phpinfo ./ext/standard/tests/general_functions/phpinfo.phpt +--- ./ext/standard/tests/general_functions/phpinfo.phpt.phpinfo 2020-07-21 10:49:31.000000000 +0200 ++++ ./ext/standard/tests/general_functions/phpinfo.phpt 2020-07-21 11:41:56.296633522 +0200 +@@ -17,7 +17,6 @@ PHP Version => %s + + System => %s + Build Date => %s%a +-Configure Command => %s + Server API => Command Line Interface + Virtual Directory Support => %s + Configuration File (php.ini) Path => %s +diff -up ./sapi/cli/php_cli.c.phpinfo ./sapi/cli/php_cli.c +--- ./sapi/cli/php_cli.c.phpinfo 2020-07-21 11:43:38.812475300 +0200 ++++ ./sapi/cli/php_cli.c 2020-07-21 11:43:45.783464540 +0200 +@@ -645,7 +645,7 @@ static int do_cli(int argc, char **argv) + "NTS" + #endif + #ifdef PHP_BUILD_COMPILER +- " " PHP_BUILD_COMPILER ++ " gcc" + #endif + #ifdef PHP_BUILD_ARCH + " " PHP_BUILD_ARCH diff --git a/php-8.1.0-systzdata-v21.patch b/php-8.1.0-systzdata-v21.patch new file mode 100644 index 0000000..fb69621 --- /dev/null +++ b/php-8.1.0-systzdata-v21.patch @@ -0,0 +1,662 @@ +# License: MIT +# http://opensource.org/licenses/MIT + +Add support for use of the system timezone database, rather +than embedding a copy. Discussed upstream but was not desired. + +History: +r21: adapt for timelib 2021.03 (in 8.1.0) +r20: adapt for timelib 2020.03 (in 8.0.10RC1) +r19: adapt for timelib 2020.02 (in 8.0.0beta2) +r18: adapt for autotool change in 7.3.3RC1 +r17: adapt for timelib 2018.01 (in 7.3.2RC1) +r16: adapt for timelib 2017.06 (in 7.2.3RC1) +r15: adapt for timelib 2017.05beta7 (in 7.2.0RC1) +r14: improve check for valid tz file +r13: adapt for upstream changes to use PHP allocator +r12: adapt for upstream changes for new zic +r11: use canonical names to avoid more case sensitivity issues + round lat/long from zone.tab towards zero per builtin db +r10: make timezone case insensitive +r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold) +r8: fix compile error without --with-system-tzdata configured +r7: improve check for valid timezone id to exclude directories +r6: fix fd leak in r5, fix country code/BC flag use in + timezone_identifiers_list() using system db, + fix use of PECL timezonedb to override system db, +r5: reverts addition of "System/Localtime" fake tzname. + updated for 5.3.0, parses zone.tab to pick up mapping between + timezone name, country code and long/lat coords +r4: added "System/Localtime" tzname which uses /etc/localtime +r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) +r2: add filesystem trawl to set up name alias index +r1: initial revision + +diff -up php-8.0.0beta3/ext/date/config0.m4.systzdata php-8.0.0beta3/ext/date/config0.m4 +--- php-8.0.0beta3/ext/date/config0.m4.systzdata 2020-09-01 19:13:26.000000000 +0200 ++++ php-8.0.0beta3/ext/date/config0.m4 2020-09-02 08:07:51.039979873 +0200 +@@ -4,6 +4,19 @@ AC_CHECK_HEADERS([io.h]) + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll) + ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ + PHP_DATE_CFLAGS="-Wno-implicit-fallthrough -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" + timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c + lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c" +diff -up php-8.0.0beta3/ext/date/lib/parse_tz.c.systzdata php-8.0.0beta3/ext/date/lib/parse_tz.c +--- php-8.0.0beta3/ext/date/lib/parse_tz.c.systzdata 2020-09-01 19:13:26.000000000 +0200 ++++ php-8.0.0beta3/ext/date/lib/parse_tz.c 2020-09-02 08:07:51.039979873 +0200 +@@ -26,9 +26,22 @@ + #include "timelib.h" + #include "timelib_private.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include ++#include ++#include ++#include ++#include ++ ++#include "php_scandir.h" ++ ++#else + #define TIMELIB_SUPPORTS_V2DATA + #define TIMELIB_SUPPORT_SLIM_FILE + #include "timezonedb.h" ++#endif ++ ++#include + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -95,6 +108,11 @@ static int read_php_preamble(const unsig + { + uint32_t version; + ++ if (memcmp(*tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return 0; ++ } ++ + /* read ID */ + version = (*tzf)[3] - '0'; + *tzf += 4; +@@ -577,7 +595,429 @@ void timelib_dump_tzinfo(timelib_tzinfo + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = trunc(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (timelib_strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".list") == NULL ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return timelib_strcasecmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st, int fd) ++{ ++ if (fd) { ++ char buf[20]; ++ if (read(fd, buf, 20)!=20) { ++ return 0; ++ } ++ lseek(fd, SEEK_SET, 0); ++ if (memcmp(buf, "TZif", 4)) { ++ return 0; ++ } ++ } ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* To allow timezone names to be used case-insensitively, find the ++ * canonical name for this timezone, if possible. */ ++static const char *canonical_tzname(const char *timezone) ++{ ++ if (timezonedb_system) { ++ timelib_tzdb_index_entry *ent, lookup; ++ ++ lookup.id = (char *)timezone; ++ ++ ent = bsearch(&lookup, timezonedb_system->index, ++ timezonedb_system->index_size, sizeof lookup, ++ sysdbcmp); ++ if (ent) { ++ return ent->id; ++ } ++ } ++ ++ return timezone; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, const char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + +@@ -603,9 +1043,48 @@ static int seek_to_tz_position(const uns + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig; ++ *map = orig; ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count) +@@ -617,7 +1096,30 @@ const timelib_tzdb_index_entry *timelib_ + int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -662,6 +1164,8 @@ static timelib_tzinfo* timelib_tzinfo_ct + timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *tzdb, int *error_code) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + int version; + int transitions_result, types_result; +@@ -669,7 +1173,7 @@ timelib_tzinfo *timelib_parse_tzfile(con + + *error_code = TIMELIB_ERROR_NO_ERROR; + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + version = read_preamble(&tzf, tmp, &type); +@@ -712,11 +1216,36 @@ timelib_tzinfo *timelib_parse_tzfile(con + return NULL; + } + ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = timelib_strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } ++ else { ++ set_default_location_and_comments(&tzf, tmp); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else { ++#endif + if (type == TIMELIB_TZINFO_PHP) { + read_location(&tzf, tmp); + } else { + set_default_location_and_comments(&tzf, tmp); + } ++#ifdef HAVE_SYSTEM_TZDATA ++ } ++#endif + } else { + *error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE; + tmp = NULL; diff --git a/php.ini b/php.ini index dae0741..fce542f 100644 --- a/php.ini +++ b/php.ini @@ -17,7 +17,7 @@ ; 6. The directory from the --with-config-file-path compile time option, or the ; Windows directory (usually C:\windows) ; See the PHP docs for more specific information. -; http://php.net/configuration.file +; https://php.net/configuration.file ; The syntax of the file is extremely simple. Whitespace and lines ; beginning with a semicolon are silently ignored (as you probably guessed). @@ -31,7 +31,7 @@ ; special sections cannot be overridden by user-defined INI files or ; at runtime. Currently, [PATH=] and [HOST=] sections only work under ; CGI/FastCGI. -; http://php.net/ini.sections +; https://php.net/ini.sections ; Directives are specified using the following syntax: ; directive = value @@ -181,7 +181,7 @@ ;;;;;;;;;;;;;;;;;;;; ; Enable the PHP scripting language engine under Apache. -; http://php.net/engine +; https://php.net/engine engine = On ; This directive determines whether or not PHP will recognize code between @@ -194,11 +194,11 @@ engine = On ; Default Value: On ; Development Value: Off ; Production Value: Off -; http://php.net/short-open-tag +; https://php.net/short-open-tag short_open_tag = Off ; The number of significant digits displayed in floating point numbers. -; http://php.net/precision +; https://php.net/precision precision = 14 ; Output buffering is a mechanism for controlling how much output data @@ -222,7 +222,7 @@ precision = 14 ; Default Value: Off ; Development Value: 4096 ; Production Value: 4096 -; http://php.net/output-buffering +; https://php.net/output-buffering output_buffering = 4096 ; You can redirect all of the output of your scripts to a function. For @@ -237,7 +237,7 @@ output_buffering = 4096 ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". ; Note: output_handler must be empty if this is set 'On' !!!! ; Instead you must use zlib.output_handler. -; http://php.net/output-handler +; https://php.net/output-handler ;output_handler = ; URL rewriter function rewrites URL on the fly by using @@ -266,16 +266,16 @@ output_buffering = 4096 ; performance, enable output_buffering in addition. ; Note: You need to use zlib.output_handler instead of the standard ; output_handler, or otherwise the output will be corrupted. -; http://php.net/zlib.output-compression +; https://php.net/zlib.output-compression zlib.output_compression = Off -; http://php.net/zlib.output-compression-level +; https://php.net/zlib.output-compression-level ;zlib.output_compression_level = -1 ; You cannot specify additional output handlers if zlib.output_compression ; is activated here. This setting does the same as output_handler but in ; a different order. -; http://php.net/zlib.output-handler +; https://php.net/zlib.output-handler ;zlib.output_handler = ; Implicit flush tells PHP to tell the output layer to flush itself @@ -283,7 +283,7 @@ zlib.output_compression = Off ; PHP function flush() after each and every call to print() or echo() and each ; and every HTML block. Turning this option on has serious performance ; implications and is generally recommended for debugging purposes only. -; http://php.net/implicit-flush +; https://php.net/implicit-flush ; Note: This directive is hardcoded to On for the CLI SAPI implicit_flush = Off @@ -314,22 +314,22 @@ serialize_precision = -1 ; and below. This directive makes most sense if used in a per-directory ; or per-virtualhost web server configuration file. ; Note: disables the realpath cache -; http://php.net/open-basedir +; https://php.net/open-basedir ;open_basedir = ; This directive allows you to disable certain functions. ; It receives a comma-delimited list of function names. -; http://php.net/disable-functions +; https://php.net/disable-functions disable_functions = ; This directive allows you to disable certain classes. ; It receives a comma-delimited list of class names. -; http://php.net/disable-classes +; https://php.net/disable-classes disable_classes = ; Colors for Syntax Highlighting mode. Anything that's acceptable in ; would work. -; http://php.net/syntax-highlighting +; https://php.net/syntax-highlighting ;highlight.string = #DD0000 ;highlight.comment = #FF9900 ;highlight.keyword = #007700 @@ -340,24 +340,24 @@ disable_classes = ; the request. Consider enabling it if executing long requests, which may end up ; being interrupted by the user or a browser timing out. PHP's default behavior ; is to disable this feature. -; http://php.net/ignore-user-abort +; https://php.net/ignore-user-abort ;ignore_user_abort = On ; Determines the size of the realpath cache to be used by PHP. This value should ; be increased on systems where PHP opens many files to reflect the quantity of ; the file operations performed. ; Note: if open_basedir is set, the cache is disabled -; http://php.net/realpath-cache-size +; https://php.net/realpath-cache-size ;realpath_cache_size = 4096k ; Duration of time, in seconds for which to cache realpath information for a given ; file or directory. For systems with rarely changing files, consider increasing this ; value. -; http://php.net/realpath-cache-ttl +; https://php.net/realpath-cache-ttl ;realpath_cache_ttl = 120 ; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc +; https://php.net/zend.enable-gc zend.enable_gc = On ; If enabled, scripts may be written in encodings that are incompatible with @@ -396,7 +396,7 @@ zend.exception_string_param_max_len = 0 ; (e.g. by adding its signature to the Web server header). It is no security ; threat in any way, but it makes it possible to determine whether you use PHP ; on your server or not. -; http://php.net/expose-php +; https://php.net/expose-php expose_php = On ;;;;;;;;;;;;;;;;;;; @@ -404,7 +404,7 @@ expose_php = On ;;;;;;;;;;;;;;;;;;; ; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time +; https://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI max_execution_time = 30 @@ -415,18 +415,18 @@ max_execution_time = 30 ; Default Value: -1 (Unlimited) ; Development Value: 60 (60 seconds) ; Production Value: 60 (60 seconds) -; http://php.net/max-input-time +; https://php.net/max-input-time max_input_time = 60 ; Maximum input variable nesting level -; http://php.net/max-input-nesting-level +; https://php.net/max-input-nesting-level ;max_input_nesting_level = 64 ; How many GET/POST/COOKIE input variables may be accepted ;max_input_vars = 1000 ; Maximum amount of memory a script may consume -; http://php.net/memory-limit +; https://php.net/memory-limit memory_limit = 128M ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -482,7 +482,7 @@ memory_limit = 128M ; Default Value: E_ALL ; Development Value: E_ALL ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting +; https://php.net/error-reporting error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; This directive controls whether or not and where PHP will output errors, @@ -499,7 +499,7 @@ error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT ; Default Value: On ; Development Value: On ; Production Value: Off -; http://php.net/display-errors +; https://php.net/display-errors display_errors = Off ; The display of errors which occur during PHP's startup sequence are handled @@ -508,7 +508,7 @@ display_errors = Off ; Default Value: On ; Development Value: On ; Production Value: Off -; http://php.net/display-startup-errors +; https://php.net/display-startup-errors display_startup_errors = Off ; Besides displaying errors, PHP can also log errors to locations such as a @@ -518,36 +518,31 @@ display_startup_errors = Off ; Default Value: Off ; Development Value: On ; Production Value: On -; http://php.net/log-errors +; https://php.net/log-errors log_errors = On -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - ; Do not log repeated messages. Repeated errors must occur in same file on same ; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors +; https://php.net/ignore-repeated-errors ignore_repeated_errors = Off ; Ignore source of message when ignoring repeated messages. When this setting ; is On you will not log errors with repeated messages from different files or ; source lines. -; http://php.net/ignore-repeated-source +; https://php.net/ignore-repeated-source ignore_repeated_source = Off ; If this parameter is set to Off, then memory leaks will not be shown (on ; stdout or in the log). This is only effective in a debug compile, and if ; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks +; https://php.net/report-memleaks report_memleaks = On ; This setting is off by default. ;report_zend_debug = 0 ; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors +; https://php.net/xmlrpc-errors ;xmlrpc_errors = 0 ; An XML-RPC faultCode @@ -557,40 +552,40 @@ report_memleaks = On ; error message as HTML for easier reading. This directive controls whether ; the error message is formatted as HTML or not. ; Note: This directive is hardcoded to Off for the CLI SAPI -; http://php.net/html-errors +; https://php.net/html-errors ;html_errors = On ; If html_errors is set to On *and* docref_root is not empty, then PHP ; produces clickable error messages that direct to a page describing the error ; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs +; You can download a copy of the PHP manual from https://php.net/docs ; and change docref_root to the base URL of your local copy including the ; leading '/'. You must also specify the file extension being used including ; the dot. PHP's default behavior is to leave these settings empty, in which ; case no links to documentation are generated. ; Note: Never use this feature for production boxes. -; http://php.net/docref-root +; https://php.net/docref-root ; Examples ;docref_root = "/phpmanual/" -; http://php.net/docref-ext +; https://php.net/docref-ext ;docref_ext = .html ; String to output before an error message. PHP's default behavior is to leave ; this setting blank. -; http://php.net/error-prepend-string +; https://php.net/error-prepend-string ; Example: ;error_prepend_string = "" ; String to output after an error message. PHP's default behavior is to leave ; this setting blank. -; http://php.net/error-append-string +; https://php.net/error-append-string ; Example: ;error_append_string = "" ; Log errors to specified file. PHP's default behavior is to leave this value ; empty. -; http://php.net/error-log +; https://php.net/error-log ; Example: ;error_log = php_errors.log ; Log errors to syslog (Event Log on Windows). @@ -613,7 +608,7 @@ report_memleaks = On ; no-ctrl (all characters except control characters) ; all (all characters) ; raw (like "all", but messages are not split at newlines) -; http://php.net/syslog.filter +; https://php.net/syslog.filter ;syslog.filter = ascii ;windows.show_crt_warning @@ -627,14 +622,14 @@ report_memleaks = On ; The separator used in PHP generated URLs to separate arguments. ; PHP's default setting is "&". -; http://php.net/arg-separator.output +; https://php.net/arg-separator.output ; Example: ;arg_separator.output = "&" ; List of separator(s) used by PHP to parse input URLs into variables. ; PHP's default setting is "&". ; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input +; https://php.net/arg-separator.input ; Example: ;arg_separator.input = ";&" @@ -648,7 +643,7 @@ report_memleaks = On ; Default Value: "EGPCS" ; Development Value: "GPCS" ; Production Value: "GPCS"; -; http://php.net/variables-order +; https://php.net/variables-order variables_order = "GPCS" ; This directive determines which super global data (G,P & C) should be @@ -661,7 +656,7 @@ variables_order = "GPCS" ; Default Value: None ; Development Value: "GP" ; Production Value: "GP" -; http://php.net/request-order +; https://php.net/request-order request_order = "GP" ; This directive determines whether PHP registers $argv & $argc each time it @@ -676,7 +671,7 @@ request_order = "GP" ; Default Value: On ; Development Value: Off ; Production Value: Off -; http://php.net/register-argc-argv +; https://php.net/register-argc-argv register_argc_argv = Off ; When enabled, the ENV, REQUEST and SERVER variables are created when they're @@ -684,7 +679,7 @@ register_argc_argv = Off ; variables are not used within a script, having this directive on will result ; in a performance gain. The PHP directive register_argc_argv must be disabled ; for this directive to have any effect. -; http://php.net/auto-globals-jit +; https://php.net/auto-globals-jit auto_globals_jit = On ; Whether PHP will read the POST data. @@ -693,48 +688,48 @@ auto_globals_jit = On ; and $_FILES to always be empty; the only way you will be able to read the ; POST data will be through the php://input stream wrapper. This can be useful ; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading +; https://php.net/enable-post-data-reading ;enable_post_data_reading = Off ; Maximum size of POST data that PHP will accept. ; Its value may be 0 to disable the limit. It is ignored if POST data reading ; is disabled through enable_post_data_reading. -; http://php.net/post-max-size +; https://php.net/post-max-size post_max_size = 8M ; Automatically add files before PHP document. -; http://php.net/auto-prepend-file +; https://php.net/auto-prepend-file auto_prepend_file = ; Automatically add files after PHP document. -; http://php.net/auto-append-file +; https://php.net/auto-append-file auto_append_file = ; By default, PHP will output a media type using the Content-Type header. To ; disable this, simply set it to be empty. ; ; PHP's built-in default media type is set to text/html. -; http://php.net/default-mimetype +; https://php.net/default-mimetype default_mimetype = "text/html" ; PHP's default character set is set to UTF-8. -; http://php.net/default-charset +; https://php.net/default-charset default_charset = "UTF-8" ; PHP internal character encoding is set to empty. ; If empty, default_charset is used. -; http://php.net/internal-encoding +; https://php.net/internal-encoding ;internal_encoding = ; PHP input character encoding is set to empty. ; If empty, default_charset is used. -; http://php.net/input-encoding +; https://php.net/input-encoding ;input_encoding = ; PHP output character encoding is set to empty. ; If empty, default_charset is used. ; See also output_buffer. -; http://php.net/output-encoding +; https://php.net/output-encoding ;output_encoding = ;;;;;;;;;;;;;;;;;;;;;;;;; @@ -748,23 +743,23 @@ default_charset = "UTF-8" ;include_path = ".;c:\php\includes" ; ; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path +; https://php.net/include-path ; The root of the PHP pages, used only if nonempty. ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root ; if you are running php as a CGI under any web server (other than IIS) ; see documentation for security issues. The alternate is to use the ; cgi.force_redirect configuration below -; http://php.net/doc-root +; https://php.net/doc-root doc_root = ; The directory under which PHP opens the script using /~username used only ; if nonempty. -; http://php.net/user-dir +; https://php.net/user-dir user_dir = ; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir +; https://php.net/extension-dir ;extension_dir = "./" ; On windows: ;extension_dir = "ext" @@ -776,14 +771,14 @@ user_dir = ; Whether or not to enable the dl() function. The dl() function does NOT work ; properly in multithreaded servers, such as IIS or Zeus, and is automatically ; disabled on them. -; http://php.net/enable-dl +; https://php.net/enable-dl enable_dl = Off ; cgi.force_redirect is necessary to provide security running PHP as a CGI under ; most web servers. Left undefined, PHP turns this on by default. You can ; turn it off here AT YOUR OWN RISK ; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect +; https://php.net/cgi.force-redirect ;cgi.force_redirect = 1 ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with @@ -794,7 +789,7 @@ enable_dl = Off ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP ; will look for to know it is OK to continue execution. Setting this variable MAY ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env +; https://php.net/cgi.redirect-status-env ;cgi.redirect_status_env = ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's @@ -803,7 +798,7 @@ enable_dl = Off ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo +; https://php.net/cgi.fix-pathinfo ;cgi.fix_pathinfo=1 ; if cgi.discard_path is enabled, the PHP CGI binary can safely be placed outside @@ -815,7 +810,7 @@ enable_dl = Off ; security context that the request runs under. mod_fastcgi under Apache ; does not currently support this feature (03/17/2002) ; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate +; https://php.net/fastcgi.impersonate ;fastcgi.impersonate = 1 ; Disable logging through FastCGI connection. PHP's default behavior is to enable @@ -827,14 +822,14 @@ enable_dl = Off ; is supported by Apache. When this option is set to 1, PHP will send ; RFC2616 compliant header. ; Default is zero. -; http://php.net/cgi.rfc2616-headers +; https://php.net/cgi.rfc2616-headers ;cgi.rfc2616_headers = 0 ; cgi.check_shebang_line controls whether CGI PHP checks for line starting with #! ; (shebang) at the top of the running script. This line might be needed if the ; script support running both as stand-alone script and via PHP CGI<. PHP in CGI ; mode skips this line and ignores its content if this directive is turned on. -; http://php.net/cgi.check-shebang-line +; https://php.net/cgi.check-shebang-line ;cgi.check_shebang_line=1 ;;;;;;;;;;;;;;;; @@ -842,16 +837,16 @@ enable_dl = Off ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. -; http://php.net/file-uploads +; https://php.net/file-uploads file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). -; http://php.net/upload-tmp-dir +; https://php.net/upload-tmp-dir ;upload_tmp_dir = ; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize +; https://php.net/upload-max-filesize upload_max_filesize = 2M ; Maximum number of files that can be uploaded via a single request @@ -862,24 +857,24 @@ max_file_uploads = 20 ;;;;;;;;;;;;;;;;;; ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen +; https://php.net/allow-url-fopen allow_url_fopen = On -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include +; Whether to allow include/require to open URLs (like https:// or ftp://) as files. +; https://php.net/allow-url-include allow_url_include = Off ; Define the anonymous ftp password (your email address). PHP's default setting ; for this is empty. -; http://php.net/from +; https://php.net/from ;from="john@doe.com" ; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent +; https://php.net/user-agent ;user_agent="PHP" ; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout +; https://php.net/default-socket-timeout default_socket_timeout = 60 ; If your scripts have to deal with files from Macintosh systems, @@ -887,7 +882,7 @@ default_socket_timeout = 60 ; unix or win32 systems, setting this flag will cause PHP to ; automatically detect the EOL character in those files so that ; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings +; https://php.net/auto-detect-line-endings ;auto_detect_line_endings = Off ;;;;;;;;;;;;;;;;;;;;;; @@ -928,26 +923,26 @@ cli_server.color = On [Date] ; Defines the default timezone used by the date functions -; http://php.net/date.timezone +; https://php.net/date.timezone ;date.timezone = -; http://php.net/date.default-latitude +; https://php.net/date.default-latitude ;date.default_latitude = 31.7667 -; http://php.net/date.default-longitude +; https://php.net/date.default-longitude ;date.default_longitude = 35.2333 -; http://php.net/date.sunrise-zenith +; https://php.net/date.sunrise-zenith ;date.sunrise_zenith = 90.833333 -; http://php.net/date.sunset-zenith +; https://php.net/date.sunset-zenith ;date.sunset_zenith = 90.833333 [filter] -; http://php.net/filter.default +; https://php.net/filter.default ;filter.default = unsafe_raw -; http://php.net/filter.default-flags +; https://php.net/filter.default-flags ;filter.default_flags = [iconv] @@ -985,7 +980,7 @@ cli_server.color = On [sqlite3] ; Directory pointing to SQLite3 extensions -; http://php.net/sqlite3.extension-dir +; https://php.net/sqlite3.extension-dir ;sqlite3.extension_dir = ; SQLite defensive mode flag (only available from SQLite 3.26+) @@ -999,14 +994,14 @@ cli_server.color = On [Pcre] ; PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit +; https://php.net/pcre.backtrack-limit ;pcre.backtrack_limit=100000 ; PCRE library recursion limit. ; Please note that if you set this value to a high number you may consume all ; the available process stack and eventually crash PHP (due to reaching the ; stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit +; https://php.net/pcre.recursion-limit ;pcre.recursion_limit=100000 ; Enables or disables JIT compilation of patterns. This requires the PCRE @@ -1015,7 +1010,7 @@ pcre.jit=0 [Pdo] ; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling +; https://php.net/pdo-odbc.connection-pooling ;pdo_odbc.connection_pooling=strict [Pdo_mysql] @@ -1024,17 +1019,17 @@ pcre.jit=0 pdo_mysql.default_socket= [Phar] -; http://php.net/phar.readonly +; https://php.net/phar.readonly ;phar.readonly = On -; http://php.net/phar.require-hash +; https://php.net/phar.require-hash ;phar.require_hash = On ;phar.cache_list = [mail function] ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path +; https://php.net/sendmail-path sendmail_path = /usr/sbin/sendmail -t -i ; Force the addition of the specified parameters to be passed as extra parameters @@ -1052,13 +1047,13 @@ mail.add_x_header = Off ;mail.log = syslog [ODBC] -; http://php.net/odbc.default-db +; https://php.net/odbc.default-db ;odbc.default_db = Not yet implemented -; http://php.net/odbc.default-user +; https://php.net/odbc.default-user ;odbc.default_user = Not yet implemented -; http://php.net/odbc.default-pw +; https://php.net/odbc.default-pw ;odbc.default_pw = Not yet implemented ; Controls the ODBC cursor model. @@ -1066,68 +1061,72 @@ mail.add_x_header = Off ;odbc.default_cursortype ; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent +; https://php.net/odbc.allow-persistent odbc.allow_persistent = On ; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent +; https://php.net/odbc.check-persistent odbc.check_persistent = On ; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent +; https://php.net/odbc.max-persistent odbc.max_persistent = -1 ; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links +; https://php.net/odbc.max-links odbc.max_links = -1 ; Handling of LONG fields. Returns number of bytes to variables. 0 means ; passthru. -; http://php.net/odbc.defaultlrl +; https://php.net/odbc.defaultlrl odbc.defaultlrl = 4096 ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. ; See the documentation on odbc_binmode and odbc_longreadlen for an explanation ; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode +; https://php.net/odbc.defaultbinmode odbc.defaultbinmode = 1 [MySQLi] ; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent +; https://php.net/mysqli.max-persistent mysqli.max_persistent = -1 ; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile +; https://php.net/mysqli.allow_local_infile ;mysqli.allow_local_infile = On +; It allows the user to specify a folder where files that can be sent via LOAD DATA +; LOCAL can exist. It is ignored if mysqli.allow_local_infile is enabled. +;mysqli.local_infile_directory = + ; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent +; https://php.net/mysqli.allow-persistent mysqli.allow_persistent = On ; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links +; https://php.net/mysqli.max-links mysqli.max_links = -1 ; Default port number for mysqli_connect(). If unset, mysqli_connect() will use ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look ; at MYSQL_PORT. -; http://php.net/mysqli.default-port +; https://php.net/mysqli.default-port mysqli.default_port = 3306 ; Default socket name for local MySQL connects. If empty, uses the built-in ; MySQL defaults. -; http://php.net/mysqli.default-socket +; https://php.net/mysqli.default-socket mysqli.default_socket = ; Default host for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host +; https://php.net/mysqli.default-host mysqli.default_host = ; Default user for mysqli_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user +; https://php.net/mysqli.default-user mysqli.default_user = ; Default password for mysqli_connect() (doesn't apply in safe mode). @@ -1135,12 +1134,17 @@ mysqli.default_user = ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") ; and reveal this password! And of course, any users with read access to this ; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw +; https://php.net/mysqli.default-pw mysqli.default_pw = ; Allow or prevent reconnect mysqli.reconnect = Off +; If this option is enabled, closing a persistent connection will rollback +; any pending transactions of this connection, before it is put back +; into the persistent connection pool. +;mysqli.rollback_on_cached_plink = Off + [mysqlnd] ; Enable / Disable collection of general statistics by mysqlnd which can be ; used to tune and monitor MySQL operations. @@ -1152,7 +1156,7 @@ mysqlnd.collect_memory_statistics = Off ; Records communication from all extensions using mysqlnd to the specified log ; file. -; http://php.net/mysqlnd.debug +; https://php.net/mysqlnd.debug ;mysqlnd.debug = ; Defines which queries will be logged. @@ -1180,44 +1184,44 @@ mysqlnd.collect_memory_statistics = Off [PostgreSQL] ; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent +; https://php.net/pgsql.allow-persistent pgsql.allow_persistent = On ; Detect broken persistent links always with pg_pconnect(). ; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent +; https://php.net/pgsql.auto-reset-persistent pgsql.auto_reset_persistent = Off ; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent +; https://php.net/pgsql.max-persistent pgsql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links +; https://php.net/pgsql.max-links pgsql.max_links = -1 ; Ignore PostgreSQL backends Notice message or not. ; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice +; https://php.net/pgsql.ignore-notice pgsql.ignore_notice = 0 ; Log PostgreSQL backends Notice message or not. ; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice +; https://php.net/pgsql.log-notice pgsql.log_notice = 0 [bcmath] ; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale +; https://php.net/bcmath.scale bcmath.scale = 0 [browscap] -; http://php.net/browscap +; https://php.net/browscap ;browscap = extra/browscap.ini [Session] ; Handler used to store/retrieve data. -; http://php.net/session.save-handler +; https://php.net/session.save-handler session.save_handler = files ; Argument passed to save_handler. In the case of files, this is the path @@ -1246,7 +1250,7 @@ session.save_handler = files ; ; where MODE is the octal representation of the mode. Note that this ; does not overwrite the process's umask. -; http://php.net/session.save-path +; https://php.net/session.save-path ; RPM note : session directory must be owned by process owner ; for mod_php, see /etc/httpd/conf.d/php.conf @@ -1263,42 +1267,42 @@ session.save_handler = files session.use_strict_mode = 0 ; Whether to use cookies. -; http://php.net/session.use-cookies +; https://php.net/session.use-cookies session.use_cookies = 1 -; http://php.net/session.cookie-secure +; https://php.net/session.cookie-secure ;session.cookie_secure = ; This option forces PHP to fetch and use a cookie for storing and maintaining ; the session id. We encourage this operation as it's very helpful in combating ; session hijacking when not specifying and managing your own session id. It is ; not the be-all and end-all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies +; https://php.net/session.use-only-cookies session.use_only_cookies = 1 ; Name of the session (used as cookie name). -; http://php.net/session.name +; https://php.net/session.name session.name = PHPSESSID ; Initialize session on request startup. -; http://php.net/session.auto-start +; https://php.net/session.auto-start session.auto_start = 0 ; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime +; https://php.net/session.cookie-lifetime session.cookie_lifetime = 0 ; The path for which the cookie is valid. -; http://php.net/session.cookie-path +; https://php.net/session.cookie-path session.cookie_path = / ; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain +; https://php.net/session.cookie-domain session.cookie_domain = ; Whether or not to add the httpOnly flag to the cookie, which makes it ; inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly +; https://php.net/session.cookie-httponly session.cookie_httponly = ; Add SameSite attribute to cookie to help mitigate Cross-Site Request Forgery (CSRF/XSRF) @@ -1308,7 +1312,7 @@ session.cookie_httponly = session.cookie_samesite = ; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler +; https://php.net/session.serialize-handler session.serialize_handler = php ; Defines the probability that the 'garbage collection' process is started on every @@ -1317,7 +1321,7 @@ session.serialize_handler = php ; Default Value: 1 ; Development Value: 1 ; Production Value: 1 -; http://php.net/session.gc-probability +; https://php.net/session.gc-probability session.gc_probability = 1 ; Defines the probability that the 'garbage collection' process is started on every @@ -1327,12 +1331,12 @@ session.gc_probability = 1 ; Default Value: 100 ; Development Value: 1000 ; Production Value: 1000 -; http://php.net/session.gc-divisor +; https://php.net/session.gc-divisor session.gc_divisor = 1000 ; After this number of seconds, stored data will be seen as 'garbage' and ; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime +; https://php.net/session.gc-maxlifetime session.gc_maxlifetime = 1440 ; NOTE: If you are using the subdirectory option for storing session files @@ -1346,16 +1350,16 @@ session.gc_maxlifetime = 1440 ; Check HTTP Referer to invalidate externally stored URLs containing ids. ; HTTP_REFERER has to contain this substring for the session to be ; considered as valid. -; http://php.net/session.referer-check +; https://php.net/session.referer-check session.referer_check = ; Set to {nocache,private,public,} to determine HTTP caching aspects ; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter +; https://php.net/session.cache-limiter session.cache_limiter = nocache ; Document expires after n minutes. -; http://php.net/session.cache-expire +; https://php.net/session.cache-expire session.cache_expire = 180 ; trans sid support is disabled by default. @@ -1367,13 +1371,13 @@ session.cache_expire = 180 ; in publicly accessible computer. ; - User may access your site with the same session ID ; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid +; https://php.net/session.use-trans-sid session.use_trans_sid = 0 ; Set session ID character length. This value could be between 22 to 256. ; Shorter length than default is supported only for compatibility reason. ; Users should use 32 or more chars. -; http://php.net/session.sid-length +; https://php.net/session.sid-length ; Default Value: 32 ; Development Value: 26 ; Production Value: 26 @@ -1388,7 +1392,7 @@ session.sid_length = 26 ; Default Value: "a=href,area=href,frame=src,form=" ; Development Value: "a=href,area=href,frame=src,form=" ; Production Value: "a=href,area=href,frame=src,form=" -; http://php.net/url-rewriter.tags +; https://php.net/url-rewriter.tags session.trans_sid_tags = "a=href,area=href,frame=src,form=" ; URL rewriter does not rewrite absolute URLs by default. @@ -1413,14 +1417,14 @@ session.trans_sid_tags = "a=href,area=href,frame=src,form=" ; Default Value: 4 ; Development Value: 5 ; Production Value: 5 -; http://php.net/session.hash-bits-per-character +; https://php.net/session.hash-bits-per-character session.sid_bits_per_character = 5 ; Enable upload progress tracking in $_SESSION ; Default Value: On ; Development Value: On ; Production Value: On -; http://php.net/session.upload-progress.enabled +; https://php.net/session.upload-progress.enabled ;session.upload_progress.enabled = On ; Cleanup the progress information as soon as all POST data has been read @@ -1428,14 +1432,14 @@ session.sid_bits_per_character = 5 ; Default Value: On ; Development Value: On ; Production Value: On -; http://php.net/session.upload-progress.cleanup +; https://php.net/session.upload-progress.cleanup ;session.upload_progress.cleanup = On ; A prefix used for the upload progress key in $_SESSION ; Default Value: "upload_progress_" ; Development Value: "upload_progress_" ; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix +; https://php.net/session.upload-progress.prefix ;session.upload_progress.prefix = "upload_progress_" ; The index name (concatenated with the prefix) in $_SESSION @@ -1443,7 +1447,7 @@ session.sid_bits_per_character = 5 ; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" ; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" ; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name +; https://php.net/session.upload-progress.name ;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" ; How frequently the upload progress should be updated. @@ -1451,18 +1455,18 @@ session.sid_bits_per_character = 5 ; Default Value: "1%" ; Development Value: "1%" ; Production Value: "1%" -; http://php.net/session.upload-progress.freq +; https://php.net/session.upload-progress.freq ;session.upload_progress.freq = "1%" ; The minimum delay between updates, in seconds ; Default Value: 1 ; Development Value: 1 ; Production Value: 1 -; http://php.net/session.upload-progress.min-freq +; https://php.net/session.upload-progress.min-freq ;session.upload_progress.min_freq = "1" ; Only write session data when session data is changed. Enabled by default. -; http://php.net/session.lazy-write +; https://php.net/session.lazy-write ;session.lazy_write = On [Assertion] @@ -1474,33 +1478,33 @@ session.sid_bits_per_character = 5 ; Default Value: 1 ; Development Value: 1 ; Production Value: -1 -; http://php.net/zend.assertions +; https://php.net/zend.assertions zend.assertions = -1 ; Assert(expr); active by default. -; http://php.net/assert.active +; https://php.net/assert.active ;assert.active = On ; Throw an AssertionError on failed assertions -; http://php.net/assert.exception +; https://php.net/assert.exception ;assert.exception = On ; Issue a PHP warning for each failed assertion. (Overridden by assert.exception if active) -; http://php.net/assert.warning +; https://php.net/assert.warning ;assert.warning = On ; Don't bail out by default. -; http://php.net/assert.bail +; https://php.net/assert.bail ;assert.bail = Off ; User-function to be called if an assertion fails. -; http://php.net/assert.callback +; https://php.net/assert.callback ;assert.callback = 0 [mbstring] ; language for internal character representation. ; This affects mb_send_mail() and mbstring.detect_order. -; http://php.net/mbstring.language +; https://php.net/mbstring.language ;mbstring.language = Japanese ; Use of this INI entry is deprecated, use global internal_encoding instead. @@ -1515,7 +1519,7 @@ zend.assertions = -1 ; mbstring.encoding_translation = On is needed to use this setting. ; If empty, default_charset or input_encoding or mbstring.input is used. ; The precedence is: default_charset < input_encoding < mbstring.http_input -; http://php.net/mbstring.http-input +; https://php.net/mbstring.http-input ;mbstring.http_input = ; Use of this INI entry is deprecated, use global output_encoding instead. @@ -1525,7 +1529,7 @@ zend.assertions = -1 ; The precedence is: default_charset < output_encoding < mbstring.http_output ; To use an output encoding conversion, mbstring's output handler must be set ; otherwise output encoding conversion cannot be performed. -; http://php.net/mbstring.http-output +; https://php.net/mbstring.http-output ;mbstring.http_output = ; enable automatic encoding translation according to @@ -1533,17 +1537,17 @@ zend.assertions = -1 ; converted to internal encoding by setting this to On. ; Note: Do _not_ use automatic encoding translation for ; portable libs/applications. -; http://php.net/mbstring.encoding-translation +; https://php.net/mbstring.encoding-translation ;mbstring.encoding_translation = Off ; automatic encoding detection order. ; "auto" detect order is changed according to mbstring.language -; http://php.net/mbstring.detect-order +; https://php.net/mbstring.detect-order ;mbstring.detect_order = auto ; substitute_character used when character cannot be converted ; one from another -; http://php.net/mbstring.substitute-character +; https://php.net/mbstring.substitute-character ;mbstring.substitute_character = none ; Enable strict encoding detection. @@ -1566,7 +1570,7 @@ zend.assertions = -1 ; Tell the jpeg decode to ignore warnings and try to create ; a gd image. The warning will then be displayed as notices ; disabled by default -; http://php.net/gd.jpeg-ignore-warning +; https://php.net/gd.jpeg-ignore-warning ;gd.jpeg_ignore_warning = 1 [exif] @@ -1575,42 +1579,42 @@ zend.assertions = -1 ; given by corresponding encode setting. When empty mbstring.internal_encoding ; is used. For the decode settings you can distinguish between motorola and ; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode +; https://php.net/exif.encode-unicode ;exif.encode_unicode = ISO-8859-15 -; http://php.net/exif.decode-unicode-motorola +; https://php.net/exif.decode-unicode-motorola ;exif.decode_unicode_motorola = UCS-2BE -; http://php.net/exif.decode-unicode-intel +; https://php.net/exif.decode-unicode-intel ;exif.decode_unicode_intel = UCS-2LE -; http://php.net/exif.encode-jis +; https://php.net/exif.encode-jis ;exif.encode_jis = -; http://php.net/exif.decode-jis-motorola +; https://php.net/exif.decode-jis-motorola ;exif.decode_jis_motorola = JIS -; http://php.net/exif.decode-jis-intel +; https://php.net/exif.decode-jis-intel ;exif.decode_jis_intel = JIS [Tidy] ; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config +; https://php.net/tidy.default-config ;tidy.default_config = /usr/local/lib/php/default.tcfg ; Should tidy clean and repair output automatically? ; WARNING: Do not use this option if you are generating non-html content ; such as dynamic images -; http://php.net/tidy.clean-output +; https://php.net/tidy.clean-output tidy.clean_output = Off [soap] ; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled +; https://php.net/soap.wsdl-cache-enabled soap.wsdl_cache_enabled=1 ; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir +; https://php.net/soap.wsdl-cache-dir ; RPM note : cache directory must be owned by process owner ; for mod_php, see /etc/httpd/conf.d/php.conf @@ -1619,7 +1623,7 @@ soap.wsdl_cache_dir="/tmp" ; (time to live) Sets the number of second while cached file will be used ; instead of original one. -; http://php.net/soap.wsdl-cache-ttl +; https://php.net/soap.wsdl-cache-ttl soap.wsdl_cache_ttl=86400 ; Sets the size of the cache limit. (Max. number of WSDL files to cache) diff --git a/php81.spec b/php81.spec index 76a487f..188ace0 100644 --- a/php81.spec +++ b/php81.spec @@ -8,19 +8,19 @@ # Please preserve changelog entries # # API/ABI check -%global apiver 20200930 -%global zendver 20200930 +%global apiver 20210902 +%global zendver 20210902 %global pdover 20170320 # Extension version %global fileinfover 1.0.5 -%global oci8ver 3.0.1 +%global oci8ver 3.1.0 %global zipver 1.19.3 # Adds -z now to the linker flags %global _hardened_build 1 # version used for php embedded library soname -%global embed_version 8.0 +%global embed_version 8.1 %global mysql_sock %(mysql_config --socket 2>/dev/null || echo /var/lib/mysql/mysql.sock) @@ -57,6 +57,13 @@ # Debug build, using --with debug %bcond_with debug +# build with system tzdata (2021 required) +%if 0%{?fedora} >= 33 || 0%{?rhel} >= 7 +%bcond_without tzdata +%else +%bcond_with tzdata +%endif + # /usr/sbin/apsx with httpd < 2.4 and defined as /usr/bin/apxs with httpd >= 2.4 %{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} %{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn 2>/dev/null || echo 0-0)}} @@ -85,21 +92,22 @@ %bcond_without libgd %bcond_with zip -%global upver 8.0.10 -#global rcver RC1 -#global lower RC1 +%global upver 8.1.0 +%global rcver RC1 +%global lower RC1 Summary: PHP scripting language for creating dynamic web sites Name: php Version: %{upver}%{?rcver:~%{lower}} -Release: 2%{?dist} +Release: 1%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD # main/snprintf.c, main/spprintf.c and main/rfc1867.c are ASL 1.0 # ext/date/lib is MIT # Zend/zend_sort is NCSA -License: PHP and Zend and BSD and MIT and ASL 1.0 and NCSA +# Zend/asm is Boost +License: PHP and Zend and BSD and MIT and ASL 1.0 and NCSA and Boost URL: http://www.php.net/ Source0: http://www.php.net/distributions/php-%{upver}%{?rcver}.tar.xz @@ -129,9 +137,7 @@ Source53: 20-ffi.ini Patch1: php-7.4.0-httpd.patch Patch5: php-7.2.0-includedir.patch Patch6: php-8.0.0-embed.patch -Patch8: php-7.4.0-libdb.patch -# get rid of deprecated functions from 8.1 -Patch9: php-8.0.6-deprecated.patch +Patch8: php-8.1.0-libdb.patch # RHEL backports Patch10: php-7.0.7-curl.patch @@ -139,7 +145,7 @@ Patch10: php-7.0.7-curl.patch # Use system nikic/php-parser Patch41: php-8.0.0-parser.patch # use system tzdata -Patch42: php-8.0.10-systzdata-v20.patch +Patch42: php-8.1.0-systzdata-v21.patch # See http://bugs.php.net/53436 Patch43: php-7.4.0-phpize.patch # Use -lldap_r for OpenLDAP @@ -148,12 +154,7 @@ Patch45: php-7.4.0-ldap_r.patch Patch46: php-8.0.7-argon2.patch # drop "Configure command" from phpinfo output # and only use gcc (instead of full version) -Patch47: php-8.0.0-phpinfo.patch -# add sha256 / sha512 security protocol, from 8.1 -Patch48: php-8.0.10-snmp-sha.patch -# switch phar to use sha256 signature by default, from 8.1 -# implement openssl_256 and openssl_512 for phar signatures, from 8.1 -Patch49: php-8.0.10-phar-sha.patch +Patch47: php-8.1.0-phpinfo.patch # RC Patch Patch91: php-7.2.0-oci8conf.patch @@ -183,7 +184,7 @@ BuildRequires: nginx-filesystem %endif BuildRequires: %{?dtsprefix}libstdc++-devel # no pkgconfig to avoid compat-openssl10 -BuildRequires: openssl-devel >= 1.0.1 +BuildRequires: openssl-devel >= 1.0.2 BuildRequires: pkgconfig(sqlite3) >= 3.7.4 BuildRequires: pkgconfig(zlib) >= 1.2.0.4 BuildRequires: smtpdaemon @@ -209,6 +210,9 @@ BuildRequires: %{?dtsprefix}systemtap-sdt-devel #BuildRequires: re2c # used for tests BuildRequires: /bin/ps +%if %{with tzdata} +BuildRequires: tzdata +%endif %if 0%{?rhel} Obsoletes: php53, php53u, php54w, php55u, php55w, php56u, php56w, mod_php70u, php70w, mod_php71u, mod_php71w, mod_php72u, mod_php72w @@ -439,7 +443,7 @@ Requires: libtool # see "php-config --libs" Requires: krb5-devel%{?_isa} Requires: libxml2-devel%{?_isa} -Requires: openssl-devel%{?_isa} >= 1.0.1 +Requires: openssl-devel%{?_isa} >= 1.0.2 %if %{with libpcre} Requires: pcre2-devel%{?_isa} %endif @@ -500,7 +504,7 @@ Requires: php-common%{?_isa} = %{version}-%{release} Obsoletes: mod_php3-imap, stronghold-php-imap BuildRequires: pkgconfig(krb5) BuildRequires: pkgconfig(krb5-gssapi) -BuildRequires: openssl-devel >= 1.0.1 +BuildRequires: openssl-devel >= 1.0.2 BuildRequires: libc-client-devel %if 0%{?rhel} Obsoletes: php53-imap, php53u-imap, php54-imap, php54w-imap, php55u-imap, php55w-imap, php56u-imap, php56w-imap @@ -522,7 +526,7 @@ License: PHP Requires: php-common%{?_isa} = %{version}-%{release} BuildRequires: pkgconfig(libsasl2) BuildRequires: openldap-devel -BuildRequires: openssl-devel >= 1.0.1 +BuildRequires: openssl-devel >= 1.0.2 %if 0%{?rhel} Obsoletes: php53-ldap, php53u-ldap, php54-ldap, php54w-ldap, php55u-ldap, php55w-ldap, php56u-ldap, php56w-ldap Obsoletes: php70u-ldap, php70w-ldap, php71u-ldap, php71w-ldap, php72u-ldap, php72w-ldap @@ -598,7 +602,7 @@ Requires: php-pdo%{?_isa} = %{version}-%{release} Provides: php_database Provides: php-pdo_pgsql, php-pdo_pgsql%{?_isa} BuildRequires: krb5-devel -BuildRequires: openssl-devel >= 1.0.1 +BuildRequires: openssl-devel >= 1.0.2 BuildRequires: postgresql-devel %if 0%{?rhel} Obsoletes: php53-pgsql, php53u-pgsql, php54-pgsql, php54w-pgsql, php55u-pgsql, php55w-pgsql, php56u-pgsql, php56w-pgsql @@ -847,6 +851,7 @@ BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(xpm) BuildRequires: pkgconfig(libwebp) +BuildRequires: pkgconfig(libavif) Provides: bundled(gd) = 2.0.35 %endif %if 0%{?rhel} @@ -1146,21 +1151,18 @@ in pure PHP. %patch5 -p1 -b .includedir %patch6 -p1 -b .embed %patch8 -p1 -b .libdb -%patch9 -p1 -b .deprecated %if 0%{?rhel} %patch10 -p1 -b .curltls %endif %patch41 -p1 -b .syslib -%if 0%{?fedora} >= 31 || 0%{?rhel} >= 6 +%if %{with tzdata} %patch42 -p1 -b .systzdata %endif %patch43 -p1 -b .headers %patch45 -p1 -b .ldap_r %patch46 -p1 -b .argon2 %patch47 -p1 -b .phpinfo -%patch48 -p1 -b .sha -%patch49 -p1 -b .pharsha %patch91 -p1 -b .remi-oci8 @@ -1169,7 +1171,7 @@ in pure PHP. # security patches # Fixes for tests related to tzdata -%if 0%{?fedora} >= 29 || 0%{?rhel} >= 6 +%if %{with tzdata} %patch300 -p1 -b .datetests %endif @@ -1177,6 +1179,7 @@ in pure PHP. # Prevent %%doc confusion over LICENSE files cp Zend/LICENSE ZEND_LICENSE +cp Zend/asm/LICENSE BOOST_LICENSE cp TSRM/LICENSE TSRM_LICENSE cp sapi/fpm/LICENSE fpm_LICENSE cp ext/mbstring/libmbfl/LICENSE libmbfl_LICENSE @@ -1193,14 +1196,10 @@ mkdir build-cgi build-apache build-embedded \ # ----- Manage known as failed test ------- # affected by systzdata patch +%if %{with tzdata} rm ext/date/tests/timezone_location_get.phpt rm ext/date/tests/timezone_version_get.phpt rm ext/date/tests/timezone_version_get_basic1.phpt -%if 0%{?fedora} < 29 -# need tzdata 2018i -rm ext/date/tests/bug33414-1.phpt -rm ext/date/tests/bug33415-2.phpt -rm ext/date/tests/date_modify-1.phpt %endif # too fast builder rm ext/date/tests/bug73837.phpt @@ -1375,7 +1374,7 @@ ln -sf ../configure --with-layout=GNU \ --with-kerberos \ --with-libxml \ -%if 0%{?fedora} >= 29 || 0%{?rhel} >= 6 +%if %{with tzdata} --with-system-tzdata \ %endif --with-mhash \ @@ -2002,7 +2001,7 @@ fi %files common -f files.common %doc EXTENSIONS NEWS UPGRADING* README.REDIST.BINS *md docs -%license LICENSE TSRM_LICENSE ZEND_LICENSE +%license LICENSE TSRM_LICENSE ZEND_LICENSE BOOST_LICENSE %license libmagic_LICENSE %license timelib_LICENSE %doc php.ini-* @@ -2152,6 +2151,10 @@ fi %changelog +* Thu Sep 2 2021 Remi Collet - 8.1.0~RC1-1 +- update to 8.1.0RC1 +- bump API version + * Tue Aug 24 2021 Remi Collet - 8.0.10-1 - Update to 8.0.10 - http://www.php.net/releases/8_0_10.php -- cgit