1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

1910 Commits

Author SHA1 Message Date
Ilija Tovilo
61c83f8af5 Merge branch 'PHP-8.5'
* PHP-8.5:
  [skip ci] Fix CLEAN for phar_extract2.phpt
2026-03-22 00:43:10 +01:00
Ilija Tovilo
afbca756e8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [skip ci] Fix CLEAN for phar_extract2.phpt
2026-03-22 00:43:04 +01:00
Ilija Tovilo
6fd46f12f5 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Fix CLEAN for phar_extract2.phpt
2026-03-22 00:42:59 +01:00
Ilija Tovilo
eca83d2baf Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Fix CLEAN for phar_extract2.phpt
2026-03-22 00:42:54 +01:00
Ilija Tovilo
0f544b0406 [skip ci] Fix CLEAN for phar_extract2.phpt
extract1/ is not created by this test, but by phar_extract.phpt, which can lead
to a very rare race condition.
2026-03-22 00:41:37 +01:00
Gina Peter Banyard
f40b356ad9 Use smart_str_append() if we have a zend_string* (#21414) 2026-03-21 17:06:14 +00:00
Arshid
006f141dd6 ext/phar: Use zend_string_concat2 instead of manual zend_string_alloc/memcpy (#21441) 2026-03-14 14:28:00 +01:00
ndossche
0155b50984 phar: Fix const-generic compile warnings 2026-03-09 20:45:07 +01:00
David Carlier
77925b971a Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21333: use-after-free when unlinking entries during iteration of a compressed phar.
2026-03-05 22:32:38 +00:00
David Carlier
449361afbf Fix GH-21333: use-after-free when unlinking entries during iteration of a compressed phar.
close GH-21334
2026-03-05 22:31:49 +00:00
Peter Kokot
8032d6fa16 Autotools: Check struct stat.st_blocks with AC_CHECK_MEMBERS (#13562)
The AC_STRUCT_ST_BLOCKS expects fileblocks object to be compiled with
AC_LIBOBJ if stat.st_blocks is missing on the system. This can be
simplified with the usual AC_CHECK_MEMBERS since PHP is using the
stat.st_blocks (and stat.st_blksize) conditionally.

These members are mostly present on all POSIX-based systems except on
Windows these days.

This also removes the obsolete HAVE_ST_BLOCKS symbol:
https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4?h=v2.72#n1055

Additionally, the st_blksize and st_blocks members are checked
conditionally with HAVE_ preprocessor macros. Instead of filtering
Windows specifically here, the preprocessor macros
HAVE_STRUCT_STAT_ST_BLKSIZE and HAVE_STRUCT_STAT_ST_BLOCKS can be used.
2026-02-10 19:59:10 +01:00
Khaled Alam
d03d69a88a Remove duplicate #include statements (#21085)
* Remove duplicate #include statements across the codebase.

* feat: Restore conditional/unconditional include pairs in lscriu.c
2026-01-30 16:37:13 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Niels Dossche
9ab800ec9b Mark Phar::buildFromIterator() base directory argument as a path
This is like buildFromDirectory() which does it right.

Closes GH-20892.
2026-01-11 12:27:36 +01:00
Niels Dossche
fb27990d3d Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20882: phar buildFromIterator breaks with missing base directory
2026-01-10 15:10:53 +01:00
Niels Dossche
b18b11ee28 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20882: phar buildFromIterator breaks with missing base directory
2026-01-10 15:10:08 +01:00
Niels Dossche
a6e0d8e359 Fix GH-20882: phar buildFromIterator breaks with missing base directory
Broke in f57526a07a because of changing a char*+size_t pair to
zend_string* (which can't handle NULL pointers in its macros).

Closes GH-20888.
2026-01-10 15:09:36 +01:00
Niels Dossche
f80338cb92 Merge branch 'PHP-8.5'
* PHP-8.5:
  [ci skip] Add missing EXTENSIONS dependency to test
2025-12-23 11:27:47 +01:00
Niels Dossche
0f01a01141 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [ci skip] Add missing EXTENSIONS dependency to test
2025-12-23 11:27:41 +01:00
Niels Dossche
8c860ce66e [ci skip] Add missing EXTENSIONS dependency to test 2025-12-23 11:27:34 +01:00
Niels Dossche
18c560d573 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix bug #74154: Phar extractTo creates empty files
2025-12-22 12:19:54 +01:00
Niels Dossche
27d4e2f302 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix bug #74154: Phar extractTo creates empty files
2025-12-22 12:19:47 +01:00
Niels Dossche
e90b48c8e5 Fix bug #74154: Phar extractTo creates empty files
The current code causes the phar entry to remain in the fname cache.
This would be fine for uncompressed phars, but is a problem for
compressed phars when they try to reopen the file pointer.
The reopen code will try to use the compressed file pointer as if it
were an uncompressed file pointer. In that case, for the given test, the
file offsets are out of bounds for the compressed file pointer because
they are the uncompressed offsets. This results in empty files.
In other cases, it's possible to read compressed parts of the file that don't
belong to that particular file.
To solve this, we simply remove the phar entry from the fname cache if
the file pointer was closed but the phar is compressed. This will make
sure that reopening the phar will not go through the cache and instead
opens up a fresh file pointer with the right decompression settings.

Closes GH-20754.
2025-12-22 12:19:21 +01:00
Niels Dossche
4f3c28aaac phar: Simplify phar_open_archive_fp() (#20753)
By returning the stream directly, we avoid calling some helpers
functions and it becomes more clear on what stream the code actually
acts upon.
2025-12-22 11:51:31 +01:00
Niels Dossche
9fffe41789 Merge branch 'PHP-8.5'
* PHP-8.5:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:43 +01:00
Niels Dossche
006788b9ef Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:37 +01:00
Niels Dossche
9cde911350 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
2025-12-21 22:29:19 +01:00
Giovanni Giacobbi
f89a3503bf Use EVP_MD_CTX_destroy() instead of EVP_MD_CTX_free() for compatibility and consistency
Closes GH-20748.
2025-12-21 22:28:57 +01:00
Niels Dossche
0880433e61 Merge branch 'PHP-8.5'
* PHP-8.5:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:47 +01:00
Niels Dossche
38e8aca77d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:39 +01:00
Niels Dossche
cf4e8e0ef6 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  phar: Fix SplFileInfo::openFile() in write mode
2025-12-21 13:18:23 +01:00
Niels Dossche
efde160ef4 phar: Fix SplFileInfo::openFile() in write mode
This stopped working after e735d2bc3b because fp_refcount is increased,
making phar think that the file has open read pointers.
To fix this, the refcount shouldn't be increased but that would
re-introduce the previous bug.
Instead, we need to add a field that "locks" the existence of the
internal entry separate from the refcount.

Closes GH-20473.
2025-12-21 13:17:54 +01:00
Niels Dossche
3e87cfa9c8 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:36 +01:00
Niels Dossche
66d4441217 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:30 +01:00
Niels Dossche
9686936378 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
2025-12-20 11:16:13 +01:00
Niels Dossche
22aaa20dab Fix GH-20732: Phar::LoadPhar undefined behavior when loading directory
The size of `got` was incorrect: it being unsigned means that the error
return codes are converted from -1 to SIZE_MAX. We should use ssize_t
instead.

Closes GH-20735.
2025-12-20 11:15:47 +01:00
Niels Dossche
2c4163c90c Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Make bug70417.phpt less flaky
2025-12-15 08:14:48 +01:00
Niels Dossche
2bf2411976 Make bug70417.phpt less flaky
Closes GH-20287.

(cherry picked from commit ed9529a7d3)
2025-12-15 08:14:41 +01:00
Niels Dossche
c9008f6dd8 Make buildFromIterator() work with custom SplFileInfo objects
While it is possible to return a custom SplFileInfo object in the
iterator used by buildFromIterator(), the data is not actually used from
that object, instead the data from the underlying internal structure is
used. This makes it impossible to override some metadata such as the
path name and modification time.

The main motivation comes from two reasons:
- Consistency. We expect our custom methods to be called when having a
  custom object.
- Support reproducibility. This is the original use case as requested in
  [1].

Add support for this by calling the getMTime() and getPathname() methods
if they're overriden by a user class.

[1] https://github.com/theseer/Autoload/issues/114.
2025-12-13 05:28:33 -08:00
Niels Dossche
521c0c5cd2 Refactor path name processing in phar_build() 2025-12-13 05:28:33 -08:00
Niels Dossche
927830da86 phar: Remove unused min_timestamp field (#20617) 2025-11-29 14:36:59 +01:00
Niels Dossche
5ae1261c6f phar: Remove dead store (#20611)
This is overwritten later anyway by contents_len.
2025-11-29 11:21:33 +01:00
Niels Dossche
a1ed754066 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:42 +01:00
Niels Dossche
6cac6d49ce Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:34 +01:00
Niels Dossche
48d80d2729 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix assertion failures resulting in crashes with stream filter object parameters
2025-11-17 18:24:13 +01:00
Niels Dossche
93ce0500aa Fix assertion failures resulting in crashes with stream filter object parameters
This works for dynamic props but not for non-dynamic props due to the
missing INDIRECT handling.

Closes GH-20500.
2025-11-17 18:23:43 +01:00
Niels Dossche
b3061dfac0 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix assertion failure when fseeking a phar file out of bounds
2025-11-15 14:34:27 +01:00
Niels Dossche
c666d6b5d9 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix assertion failure when fseeking a phar file out of bounds
2025-11-15 14:34:21 +01:00
Niels Dossche
3a2868fb76 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix assertion failure when fseeking a phar file out of bounds
2025-11-15 14:33:58 +01:00
Niels Dossche
d9e40372fc Fix assertion failure when fseeking a phar file out of bounds
In 61884c3b52 I added these FIXME comments after I noticed that this
would cause an assertion failure. At that time I did not yet know what
to do here. I took a look at the code now and other streams return -1
and leave the file position untouched. So we do the same for phar.
This fixes the assertion failure and subsequent crashes, but also
changes one test output. However, I believe the new test output is
correct.

Closes GH-20475.
2025-11-15 14:33:33 +01:00