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

6308 Commits

Author SHA1 Message Date
Nora Dossche
583be5a8ca Fix compile warnings under GCC 15.2.1 (#21320)
The compiler now infers constness through string functions.
Adhere to that.
It also now warns about using multiplications in conditions.
2026-03-02 23:12:06 +01:00
Daniel Scherzer
90cb181844 php_version.h: remove trailing whitespace
Causes the verification of generated files to fail
2026-02-24 18:45:08 -05:00
Calvin Buckley
9942f063db PHP-8.4 is now for PHP 8.4.20-dev 2026-02-24 17:50:02 -05:00
Arnaud Le Blanc
ede7c67389 Fix build with -std=
When building in strict mode (e.g. -std=c11), compilation of
main/debug_gdb_scripts.c fails because asm() is not a standard top level
statement. __asm__() however can be reserved by the compiler even in strict
mode.

Partially fixes GH-21215. IR needs a similar fix (dstogov/ir#128).
Closes GH-21226.
2026-02-16 14:48:48 +01:00
Saki Takamachi
e6beffb6ed PHP-8.4 is now for PHP 8.4.19-dev 2026-01-27 22:21:42 +09:00
Tim Düsterhus
b5d6377ada output: Fail starting to output buffer when the output layer is deactivated (#20846)
Fixes php/php-src#20837.
2026-01-10 14:37:52 +01:00
Niels Dossche
60b1f59081 fastcgi: Fix compile warning wrt safe_read() (#20887)
This shouldn't be const. Fixes the following warning:
```
warning: variable 'hdr' is uninitialized when passed as a const pointer argument here
      [-Wuninitialized-const-pointer]
 1054 |         if (safe_read(req, &hdr, sizeof(fcgi_header)) != sizeof(fcgi_header) ||
      |                             ^~~
```
2026-01-10 10:49:37 +01:00
Niels Dossche
5484ebcc49 streams/memory: Ensure internal string is NUL terminated (#20812)
zend_string_truncate() doesn't put a NUL byte.
2026-01-02 18:03:17 +01:00
Calvin Buckley
5726e53b39 PHP 8.4 is now for PHP 8.4.18-dev 2025-12-30 13:07:11 -04:00
Niels Dossche
0590a34aee Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
2025-12-19 19:36:53 +01:00
Niels Dossche
ee0143887d Fix GH-20352: UAF in php_output_handler_free via re-entrant ob_start() during error deactivation
The problem is that the code is doing `php_output_handler_free` in a loop on the output stack,
but prior to freeing the pointer on the stack in `php_output_handler_free` it calls
`php_output_handler_dtor` which can run user code that reallocates the stack,
resulting in a dangling pointer freed by php_output_handler_free.
Furthermore, OG(active) is set when creating a new output handler, but
the loop is supposed to clean up all handlers, so OG(active) must be
reset as well.

Closes GH-20356.
2025-12-19 19:36:26 +01:00
Saki Takamachi
2ec8c29fda PHP-8.4 is now for PHP 8.4.17-dev 2025-12-03 14:52:20 +09:00
Eric Mann
e10f6d702f PHP-8.3 is now for PHP 8.3.30-dev 2025-12-02 09:05:38 -08:00
David Carlier
1701589884 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:05:37 +00:00
David Carlier
4312a446d0 Fix GH-20601: ftp_connect() timeout argument overflow.
close GH-20603
2025-11-29 23:05:14 +00:00
Niels Dossche
eb733a3127 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20286: use-after-destroy during userland stream_close()
2025-11-23 17:51:35 +01:00
Niels Dossche
27f17c3322 Fix GH-20286: use-after-destroy during userland stream_close()
Closes GH-20493.

Co-authored-by: David Carlier <devnexen@gmail.com>
2025-11-23 17:46:28 +01:00
Calvin Buckley
57deb6c11b PHP 8.4 is now for PHP 8.4.16-dev
(Looks like this wasn't bumped for 8.4.15-dev previously)
2025-11-04 12:07:39 -04:00
Jakub Zelenka
17f253a1f2 PHP-8.3 is now for PHP 8.3.29-dev 2025-11-04 15:13:43 +01:00
Jakub Zelenka
2a0931d347 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
2025-10-23 15:22:21 +02:00
Jakub Zelenka
eef11e048d Fix GH-19798: XP_SOCKET XP_SSL: Incorrect condition for Win
This fixes incorrect type conversion and subsequent check for Windows
where returned socket is not an int.

It should be noted that this is not really an issue as previous int
would get negative so the check should still work. The issue actually
happens only in master (PHP 8.5) where refactoring has been done and the
type changed.

Closes GH-19881
2025-10-23 15:11:14 +02:00
Eric Mann
91eb2a558d PHP-8.3 is now for PHP 8.3.28-dev 2025-10-07 06:58:36 -07:00
Tim Düsterhus
08924cd8c4 Regenerate main/debug_gdb_scripts.c
Following 9d9b73a3f0 / GH-20077.
2025-10-06 20:45:14 +02:00
Niels Dossche
2edb369181 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19570: unable to fseek in /dev/zero and /dev/null
2025-10-06 18:16:37 +02:00
Niels Dossche
b7aeb0a69f Fix GH-19570: unable to fseek in /dev/zero and /dev/null
On Linux, these two character devices are exceptions in that they can be
seeked. Check their major/minor device number.

Co-authored-by: divinity76 <hans@loltek.net>
2025-10-06 18:16:16 +02:00
Jakub Zelenka
57e1438ca5 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-02 19:22:59 +02:00
Jakub Zelenka
288d698ce4 Prevent use after stack scope in stream strerr code (#20040) 2025-10-02 19:22:28 +02:00
Jakub Zelenka
10eb3d69c7 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-02 13:43:47 +02:00
Jakub Zelenka
a3c14d6ab4 Do not use errno_t as it is not defined on musl (#20037) 2025-10-02 13:42:11 +02:00
David Carlier
3193fe0728 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-02 12:30:41 +01:00
David Carlier
175afc4085 Fix GH-19705: do not flush/write buffer on non writeable stream.
Co-authored-by: Jakub Zelenka <bukka@php.net>

close GH-19708
2025-10-02 12:28:36 +01:00
Niels Dossche
7dd7ad843d Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-17345: Bug #35916 was not completely fixed
2025-10-01 11:50:05 +02:00
Niels Dossche
0ffa337a54 Fix GH-17345: Bug #35916 was not completely fixed
Change the reproducer code in `bug35916.phpt` from `stream_bucket_append` to
`stream_bucket_prepend` and you have the same bug.
Furthermore, even in the append case the check is incorrect because the bucket
can already be in the brigade at a position other than the tail.
To solve this properly, unlink the brigade first and also use that as a
condition to manage the refcount.

Closes GH-18973.
2025-10-01 11:49:28 +02:00
Jakub Zelenka
152dfa8835 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-01 11:12:42 +02:00
Jakub Zelenka
b7fdfb7147 Fix GH-19248: Use strerror_r instead of strerror in main
Or on Windows it is going to use either FormatMessageW or strerror_s
for compatibility with previous error messages.

It also needs to accomodate for GNU and BSD versions of strerror_r
returning different type.

Closes GH-19251
2025-10-01 11:12:08 +02:00
David Carlier
03de7b0b28 Merge branch 'PHP-8.3' into PHP-8.4 2025-09-29 22:48:38 +01:00
David Carlier
93bac8cb1a Fix GH-19922: gzopen() double free
close GH-19924
2025-09-29 22:47:29 +01:00
Arnaud Le Blanc
938226083e Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19480: error_log php.ini cannot be unset when open_basedir is configured
2025-09-19 14:16:48 +02:00
Niels Dossche
7a1bb71127 Fix GH-19480: error_log php.ini cannot be unset when open_basedir is configured
Since the ini message handlers already check for basedir, we need to
drop the basedir check from ini_set. Then we also fix the exceptional
case for the empty string: it should bypass the basedir check.
Furthermore, there was a regression introduced with the error_log
"syslog" check in ddfe269a (inverted check), so we fix that as well.

Closes GH-19487
2025-09-19 14:14:53 +02:00
Jakub Zelenka
c9cc68b9ed PHP-8.3 is now for PHP-8.3.27-dev 2025-09-09 23:02:24 +02:00
Calvin Buckley
635376d22d PHP 8.4 is now for PHP 8.4.14-dev 2025-09-09 11:37:59 -03:00
Niels Dossche
89f2805905 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #385993744
2025-09-08 19:10:41 +02:00
Niels Dossche
ff84cb08ef Fix OSS-Fuzz #385993744
PSFS_FEED_ME is supposed to be returned when the filter did not receive
enough data and did not generate buckets for the output brigade.
The test generates buckets anyway on the output brigade, and the stream
layer did not handle that case causing a memory leak.
To solve this, discard any such buckets as it would conflict with the
status code returned by the filter. This keeps BC and solves the leak.

Closes GH-18972.
2025-09-08 19:10:22 +02:00
Niels Dossche
ad129c6f97 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Remove incorrect call to zval_ptr_dtor() in user_wrapper_metadata()
2025-09-04 23:13:45 +02:00
Niels Dossche
d10ff9bbd8 Remove incorrect call to zval_ptr_dtor() in user_wrapper_metadata()
This one is not initialized. This is not hittable from userspace code
because all locations within first-party php-src code have a valid
`option` argument.

Closes GH-19714.
2025-09-04 23:13:20 +02:00
Eric Mann
a0bd2c9fcf PHP-8.3 is now for PHP 8.3.26-dev 2025-08-12 08:15:40 -07:00
Saki Takamachi
b7c26eb16c PHP-8.4 is now for PHP 8.4.13-dev 2025-08-12 23:46:26 +09:00
Niels Dossche
1c74a1a889 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Free opened_path when opened_path_len >= MAXPATHLEN
2025-07-27 10:54:46 +02:00
dixyes
5dd965117a Free opened_path when opened_path_len >= MAXPATHLEN
Closes GH-19240.
2025-07-27 10:54:21 +02:00
Jakub Zelenka
faf833bffc PHP 8.3 is now for PHP-8.3.25-dev 2025-07-16 14:09:24 +02:00