Core: Fixed bug GH-13922 (Fixed support for systems with sysconf(_SC_GETPW_R_SIZE_MAX) == -1). Fixed bug GH-14626 (Fix is_zend_ptr() for huge blocks). Fixed bug GH-14590 (Memory leak in FPM test gh13563-conf-bool-env.phpt. Fixed OSS-Fuzz #69765. Fixed bug GH-14741 (Segmentation fault in Zend/zend_types.h). Fixed bug GH-14969 (Use-after-free in property coercion with __toString()). Dom: Fixed bug GH-14702 (DOMDocument::xinclude() crash). Fileinfo: Fixed bug GH-14888 (README.REDIST.BINS refers to non-existing LICENSE). Gd: ext/gd/tests/gh10614.phpt: skip if no PNG support. restored warning instead of fata error. LibXML: Fixed bug GH-14563 (Build failure with libxml2 v2.13.0). Opcache: Fixed bug GH-14550 (No warning message when Zend DTrace is enabled that opcache.jit is implictly disabled). Output: Fixed bug GH-14808 (Unexpected null pointer in Zend/zend_string.h with empty output buffer). PDO: Fixed bug GH-14712 (Crash with PDORow access to null property). Phar: Fixed bug GH-14603 (null string from zip entry). PHPDBG: Fixed bug GH-14596 (crashes with ASAN and ZEND_RC_DEBUG=1). Fixed bug GH-14553 (echo output trimmed at NULL byte). Shmop: Fixed bug GH-14537 (shmop Windows 11 crashes the process). SPL: Fixed bug GH-14639 (Member access within null pointer in ext/spl/spl_observer.c). Standard: Fixed bug GH-14775 (range function overflow with negative step argument). Fix 32-bit wordwrap test failures. Fixed bug GH-14774 (time_sleep_until overflow). Streams: Fixed bug GH-14930 (Custom stream wrapper dir_readdir output truncated to 255 characters in PHP 8.3). Tidy: Fix memory leak in tidy_repair_file(). Treewide: Fix compatibility with libxml2 2.13.2. XML: Move away from to-be-deprecated libxml fields. Fixed bug GH-14834 (Error installing PHP when --with-pear is used). OBS-URL: https://build.opensuse.org/package/show/devel:languages:php/php8?expand=0&rev=170
110 lines
3.7 KiB
Diff
110 lines
3.7 KiB
Diff
From 485e2a4e43458a417603d4ed219af3e79854ef46 Mon Sep 17 00:00:00 2001
|
|
From: Arjen de Korte <build+github@de-korte.org>
|
|
Date: Sat, 2 Jan 2021 17:57:18 +0100
|
|
Subject: [PATCH 1/1] phar: honor SOURCE_DATE_EPOCH for timestamps
|
|
|
|
In order to build reproducible phars, honor SOURCE_DATE_EPOCH
|
|
if set
|
|
|
|
Signed-off-by: Arjen de Korte <build+github@de-korte.org>
|
|
---
|
|
ext/phar/phar.c | 2 +-
|
|
ext/phar/phar_internal.h | 15 +++++++++++++++
|
|
ext/phar/stream.c | 2 +-
|
|
ext/phar/tar.c | 2 +-
|
|
ext/phar/util.c | 2 +-
|
|
ext/phar/zip.c | 2 +-
|
|
6 files changed, 18 insertions(+), 5 deletions(-)
|
|
|
|
Index: php-8.3.8/ext/phar/phar.c
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/phar.c
|
|
+++ php-8.3.8/ext/phar/phar.c
|
|
@@ -2996,7 +2996,7 @@ int phar_flush(phar_archive_data *phar,
|
|
4: metadata-len
|
|
+: metadata
|
|
*/
|
|
- mytime = time(NULL);
|
|
+ mytime = source_date_epoch_time(NULL);
|
|
phar_set_32(entry_buffer, entry->uncompressed_filesize);
|
|
phar_set_32(entry_buffer+4, mytime);
|
|
phar_set_32(entry_buffer+8, entry->compressed_filesize);
|
|
Index: php-8.3.8/ext/phar/phar_internal.h
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/phar_internal.h
|
|
+++ php-8.3.8/ext/phar/phar_internal.h
|
|
@@ -427,6 +427,21 @@ static inline enum phar_fp_type phar_get
|
|
return PHAR_G(cached_fp)[entry->phar->phar_pos].manifest[entry->manifest_pos].fp_type;
|
|
}
|
|
|
|
+static inline time_t source_date_epoch_time(time_t *tloc)
|
|
+{
|
|
+ const char *sde;
|
|
+ time_t ts;
|
|
+
|
|
+ tsrm_env_lock();
|
|
+ sde = getenv("SOURCE_DATE_EPOCH");
|
|
+ ts = (sde) ? strtoul(sde, NULL, 10) : time(0);
|
|
+ tsrm_env_unlock();
|
|
+ if (tloc) {
|
|
+ *tloc = ts;
|
|
+ }
|
|
+ return ts;
|
|
+}
|
|
+
|
|
static inline zend_off_t phar_get_fp_offset(phar_entry_info *entry)
|
|
{
|
|
if (!entry->is_persistent) {
|
|
Index: php-8.3.8/ext/phar/stream.c
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/stream.c
|
|
+++ php-8.3.8/ext/phar/stream.c
|
|
@@ -474,7 +474,7 @@ static int phar_stream_flush(php_stream
|
|
phar_entry_data *data = (phar_entry_data *) stream->abstract;
|
|
|
|
if (data->internal_file->is_modified) {
|
|
- data->internal_file->timestamp = time(0);
|
|
+ data->internal_file->timestamp = source_date_epoch_time(0);
|
|
ret = phar_flush(data->phar, 0, 0, 0, &error);
|
|
if (error) {
|
|
php_stream_wrapper_log_error(stream->wrapper, REPORT_ERRORS, "%s", error);
|
|
Index: php-8.3.8/ext/phar/tar.c
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/tar.c
|
|
+++ php-8.3.8/ext/phar/tar.c
|
|
@@ -965,7 +965,7 @@ int phar_tar_flush(phar_archive_data *ph
|
|
char halt_stub[] = "__HALT_COMPILER();";
|
|
|
|
entry.flags = PHAR_ENT_PERM_DEF_FILE;
|
|
- entry.timestamp = time(NULL);
|
|
+ entry.timestamp = source_date_epoch_time(NULL);
|
|
entry.is_modified = 1;
|
|
entry.is_crc_checked = 1;
|
|
entry.is_tar = 1;
|
|
Index: php-8.3.8/ext/phar/util.c
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/util.c
|
|
+++ php-8.3.8/ext/phar/util.c
|
|
@@ -584,7 +584,7 @@ phar_entry_data *phar_get_or_create_entr
|
|
|
|
phar_add_virtual_dirs(phar, path, path_len);
|
|
etemp.is_modified = 1;
|
|
- etemp.timestamp = time(0);
|
|
+ etemp.timestamp = source_date_epoch_time(0);
|
|
etemp.is_crc_checked = 1;
|
|
etemp.phar = phar;
|
|
etemp.filename = estrndup(path, path_len);
|
|
Index: php-8.3.8/ext/phar/zip.c
|
|
===================================================================
|
|
--- php-8.3.8.orig/ext/phar/zip.c
|
|
+++ php-8.3.8/ext/phar/zip.c
|
|
@@ -1236,7 +1236,7 @@ int phar_zip_flush(phar_archive_data *ph
|
|
|
|
pass.error = &temperr;
|
|
entry.flags = PHAR_ENT_PERM_DEF_FILE;
|
|
- entry.timestamp = time(NULL);
|
|
+ entry.timestamp = source_date_epoch_time(NULL);
|
|
entry.is_modified = 1;
|
|
entry.is_zip = 1;
|
|
entry.phar = phar;
|