1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00
Commit Graph

789 Commits

Author SHA1 Message Date
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 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 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 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 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
Niels Dossche 7809d51918 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Revert "ext/phar: Voidify flush function as it always returns EOL"
  phar: Fix broken return value of fflush() for phar file entries
2025-11-15 13:59:38 +01:00
Niels Dossche 08ec409f1b Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  phar: Fix broken return value of fflush() for phar file entries
2025-11-15 13:58:17 +01:00
Niels Dossche 2f9d86b677 phar: Fix broken return value of fflush() for phar file entries
The flush functions always return EOF, even in the success path.
The success path should return 0 to indicate success.

Closes GH-20474.
2025-11-15 13:56:06 +01:00
Niels Dossche 5087cf3001 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20435: SensitiveParameter doesn't work for named argument passing to variadic parameter
  Fix GH-20442: Phar does not respect case-insensitiveness of __halt_compiler() when reading stub
2025-11-10 22:44:16 +01:00
Niels Dossche 3e715d3361 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20435: SensitiveParameter doesn't work for named argument passing to variadic parameter
  Fix GH-20442: Phar does not respect case-insensitiveness of __halt_compiler() when reading stub
2025-11-10 22:43:59 +01:00
Niels Dossche 4ee25395d5 Fix GH-20442: Phar does not respect case-insensitiveness of __halt_compiler() when reading stub
Functions are case insensitive. The flush code already takes this into
account by checking for the __halt_compiler() symbol in a case
insensitive manner; however the parsing code did not do that yet.

Closes GH-20445.
2025-11-10 22:42:32 +01:00
Niels Dossche 1dd866d89c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20302: Freeing a phar alias may invalidate PharFileInfo objects
2025-10-31 08:07:28 +01:00
Niels Dossche ae7117b177 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20302: Freeing a phar alias may invalidate PharFileInfo objects
2025-10-31 08:05:01 +01:00
Niels Dossche 6fe40de6e3 Fix GH-20302: Freeing a phar alias may invalidate PharFileInfo objects
Closes GH-20345.
2025-10-31 08:04:25 +01:00
Niels Dossche d3ee9aa870 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Make bug70417.phpt less flaky
2025-10-25 12:14:38 +02:00
Niels Dossche e9c9b1fdcf Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Make bug70417.phpt less flaky
2025-10-25 12:14:19 +02:00
Niels Dossche ed9529a7d3 Make bug70417.phpt less flaky
Closes GH-20287.
2025-10-25 12:13:58 +02:00
Niels Dossche 90eabf57ab Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  phar: Fix memory leak when openssl polyfill returns garbage
2025-10-20 22:04:17 +02:00
Niels Dossche 4c043d89ec Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  phar: Fix memory leak when openssl polyfill returns garbage
2025-10-20 22:04:09 +02:00
Niels Dossche 020bbea8fd phar: Fix memory leak when openssl polyfill returns garbage
Closes GH-20210.
2025-10-20 22:03:36 +02:00
Nicolas Grekas fc353966f3 Revert deprecation of __sleep and __wakeup (#19966) 2025-10-06 10:30:27 +02:00
Niels Dossche fced2d8ff4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix memory leak and invalid continuation after tar header writing fails
2025-10-01 10:47:43 +02:00
Niels Dossche c3d17d93d3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak and invalid continuation after tar header writing fails
2025-10-01 10:47:28 +02:00
Niels Dossche 7c859268c0 Fix memory leak and invalid continuation after tar header writing fails
Closes GH-20003.
2025-10-01 10:46:33 +02:00
Gina Peter Banyard 05eda4318d Add missing extension dependencies for tests 2025-09-11 15:10:49 +02:00
Gina Peter Banyard a5f2eee785 Zend: Deprecate __wakeup() (#19435)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
2025-09-11 06:57:21 +01:00
Gina Peter Banyard f18e99244b Zend: Deprecate __sleep() (#19682)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_sleep_and_wakeup_magic_methods
2025-09-10 08:54:16 +01:00
Niels Dossche 79eca3f2bf Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19752: Phar decompression with invalid extension can cause UAF
2025-09-08 23:11:07 +02:00
Niels Dossche c395355728 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19752: Phar decompression with invalid extension can cause UAF
2025-09-08 23:11:01 +02:00
Niels Dossche f6878b6ccf Fix GH-19752: Phar decompression with invalid extension can cause UAF
The rename code can error out prior to the reassignment of the filename,
which is why the test causes a crash.
The rename code can also error out at a later point,
which means it will have already assigned the new filename.
We detect in which case we are in and act accordingly.

Closes GH-19761.
2025-09-08 23:10:33 +02:00
Niels Dossche 91be3e196a Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix memory leak on failure in phar_convert_to_other()
  Fix metadata leak when phar convert logic fails
2025-09-08 19:06:42 +02:00
Niels Dossche 10a2a2a368 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix memory leak on failure in phar_convert_to_other()
  Fix metadata leak when phar convert logic fails
2025-09-08 19:06:37 +02:00
Niels Dossche c50b37d231 Fix metadata leak when phar convert logic fails
Closes GH-19756.
2025-09-08 19:05:47 +02:00
Niels Dossche d92675b6c1 [ci skip] Fix comment after a3de2ce9 2025-08-17 01:33:23 +02:00
Ilija Tovilo 9c754baa99 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
2025-08-14 12:16:16 +02:00
Ilija Tovilo 708d8e9cfd Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
2025-08-14 12:15:00 +02:00
Ilija Tovilo a3de2ce9ba Fix "Constant already defined" warning with repeated inclusion of file with __halt_compiler()
Fixes GH-18850
Closes GH-19471
2025-08-14 12:13:50 +02:00
Gina Peter Banyard 1e0c8baf05 tree: drop non canonical casts and ZPP tests 2025-08-06 13:20:28 +01:00
Ilija Tovilo 1039cebb87 Merge branch 'PHP-8.4'
* PHP-8.4:
  [skip ci] Add missing zlib dep to phar compression test
2025-07-07 16:28:58 +02:00
Ilija Tovilo 74784a0d52 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Add missing zlib dep to phar compression test
2025-07-07 16:28:49 +02:00
Ilija Tovilo faa78313d9 [skip ci] Add missing zlib dep to phar compression test 2025-07-07 16:28:18 +02:00
Niels Dossche 5a2a150829 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix phar crash and file corruption with SplFileObject
2025-07-05 21:44:39 +02:00