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

6496 Commits

Author SHA1 Message Date
Gina Peter Banyard
93ec0ac0f3 streams: drop unused includes 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
fa85b38560 streams: voidify php_stream_filter_prepend_ex()
This only ever returned SUCCESS
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
fb2585f4e2 streams: use -1 directly instead of FAILURE macro
The result of the functions returning those globals is never checked anyway
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
4b6ebcc6e9 streams: remove confusing step variable 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
02af9acfca streams: use precomputed persistant variable 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
67d6160462 streams: use int type instead of long
The flags variable is passed to the filter virtual function that requires an int
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
c9836b03ce streams: use type size_t instead of type unsigned int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
841afdc486 streams: use type zend_result instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b3551cc31f streams: use type bool instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
b35dbe474e streams: reduce scope of variables 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
17b8706bf6 streams: add const specifier 2025-08-04 15:30:57 +01:00
Ilija Tovilo
cd80ed6f7b Implement changes to GH-17951 according to ML discussion 2025-08-04 16:04:25 +02:00
Frederik Milling Pytlick
4e21924271 Fix GH-17951: Addition of max_memory_limit INI
Closes GH-18011
2025-08-04 16:04:25 +02:00
Gina Peter Banyard
a66b631bce main/php_ini: various minor refactorings (#19339) 2025-08-03 17:30:12 +01:00
Gina Peter Banyard
961412d6f2 main: refactor implementation of set_time_limit() (#19338) 2025-08-03 16:17:00 +01:00
Gina Peter Banyard
105c1e9896 tree: use zend_str_has_nul_byte() API (#19336) 2025-07-31 23:57:27 +01:00
Calvin Buckley
18dee43e02 Add SAPI_HEADER_DELETE_PREFIX, make ext/session use it (#18678)
* Add SAPI_HEADER_DELETE_PREFIX operation

The session ext currently munges into the linked list of headers
itself, because the delete header API is given the key for headers to
delete. The session ext wants to use a prefix past the colon separator,
for i.e. "Set-Cookie: PHPSESSID=", to eliminate only the specific cookie
rather than all cookies.

This changes the SAPI code to add a new header op to take a prefix
instead. Call sites are yet unchanged. Also fix some whitespace.

* Simplify cookie setting code in ext/session

Use the modern SAPI header ops API, including the remove prefix op we
just added.

* [ci skip] Remove redundant and unnecessary comment

The purpose of this is clear, and after refactoring, the special case is
no longer there, so it has no value.

* Un-deprecate simple add/replace header API, use it

Suggestion from Jakub.

* Restore the optimization removing session cookies had

I don't think this needs to be special cased with the parameter.

* Move setting header length to caller

Suggestion from Jakub.

* [ci skip] adjust tab count

It may be better to use spaces in here instead.

* Use session_cookie_len rather than calling strlen
2025-07-31 19:52:04 -03:00
Gina Peter Banyard
dad28a30f3 main: pack _php_netstream_data_t and use bool instead of int type (#19331)
Fix use sites at the same time
2025-07-31 19:56:38 +01:00
Gina Peter Banyard
9db21e18ad main/streams/transports.c: remove useless cast (#19330)
The function pointer type declaration requires name to be a const char*
2025-07-31 12:44:58 +01:00
Arnaud Le Blanc
c561f7da85 Refresh zend_mm shadow key on fork
The shadow key is refreshed when resetting the memory manager between two
requests. But in forking SAPIs the first request of a child process inherits the
shadow key of the parent. As a result, a leak of the shadow key during the first
request of one process gives away the shadow key used during the first request
of other processes. This makes the key refresh mechanism less useful.

Here I ensure that we refresh the shadow key after a fork. We can not reset the
manager as there may be active allocations. Instead, we have to recompute shadow
pointers with the new key.

Closes GH-16765
2025-07-29 14:00:37 +02:00
Niels Dossche
9b777b3c35 Merge branch 'PHP-8.4'
* PHP-8.4:
  Free opened_path when opened_path_len >= MAXPATHLEN
2025-07-27 10:54:53 +02: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
Tim Düsterhus
7f1b3606a8 main: Add PHP_BUILD_PROVIDER userland constant (#19157)
This constant can be handy for tools like PIE to determine the origin of a PHP
binary to provide better output / diagnostics.

see php/pie#275
see php/php-src#18168
2025-07-21 10:43:14 +02:00
Tim Düsterhus
6b3f302132 streams: Re-add support for arbitrary metadata for stream notifier functions (#19158)
Support for attaching arbitrary metadata for consumption by stream notifier
functions got broken in php/php-src#19024 when the previous `zval ptr` got
changed to `zend_fcall_info_cache *fcc`, making the data specific to the
`user_space_stream_notifier`.

Fix this by changing the field to `void *ptr`, avoiding the indirection through
a `zval`, but preserving the ability to store arbitrary data. If necessary to
support different types than `IS_PTR`, extensions can heap-allocate a `zval` to
store within `->ptr` as a minimal change to keep compatibility with PHP 8.4 or
lower.
2025-07-17 23:01:43 +02:00
Jakub Zelenka
faf833bffc PHP 8.3 is now for PHP-8.3.25-dev 2025-07-16 14:09:24 +02:00
Calvin Buckley
3d468a181a PHP-8.4 is now for PHP 8.4.12-dev 2025-07-15 13:46:33 -03:00
Peter Kokot
a4d39f9713 Fix missing strnlen symbol on Solaris 10 (#19109)
- On Solaris, strnlen was implemented on Solaris 11.
- In Autotools, strnlen can be also checked in Zend scope as
  HAVE_STRNLEN is used only there.
2025-07-14 23:07:04 +02:00
DanielEScherzer
07f1cfd9b0 Deprecate producing output in a user output handler (#19067)
https://wiki.php.net/rfc/deprecations_php_8_4
2025-07-09 21:20:58 -07:00
DanielEScherzer
d8577d9bfb Deprecate returning non-string values from a user output handler (#18932)
https://wiki.php.net/rfc/deprecations_php_8_4
2025-07-07 14:31:13 -07:00
Gina Peter Banyard
677a1f80c8 ext/standard/stream: Use FCC instead of zval for notification callback (#19024)
Also check that the callable exists while setting the option
2025-07-06 01:30:07 +01:00
Saki Takamachi
d5fe1bce63 PHP-8.4 is now for PHP 8.4.11-dev 2025-07-02 11:39:33 +09:00
Peter Kokot
8a75b3c50c Remove conditional checks for ssize_t type (#18996)
The ssize_t type is already used unconditionally in php-src code
everywhere except the main/s{n,p}printf.c files. On Windows ssize_t is
available as an alias to the SSIZE_T defined in BaseTsd.h (available in
affected files through the included windows.h in zend_config.w32.h).

This also makes the Autoconf macro PHP_CHECK_SIZEOF obsolete in favor of
the AC_CHECK_SIZEOF, which is more convenient to check for types without
the need to run the test program - omitting the cross-compilation
issues. AC_CHECK_SIZEOF once didn't provide including additional headers
(resolved in Autoconf versions after 2.13).
2025-07-02 01:45:40 +02:00
Jakub Zelenka
cf0c39723e Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-07-01 09:34:23 -07:00
Ilija Tovilo
49d94cced0 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GHSA-453j-q27h-5p8x
  Fix GHSA-hrwm-9436-5mv3: pgsql escaping no error checks
  Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
2025-07-01 17:48:00 +02:00
Jakub Zelenka
5ef0dc7666 Fix GHSA-3cr5-j632-f35r: Null byte in hostnames
This fixes stream_socket_client() and fsockopen().

Specifically it adds a check to parse_ip_address_ex and it also makes
sure that the \0 is not ignored in fsockopen() hostname formatting.
2025-07-01 23:01:16 +09:00
Peter Kokot
db157e3168 Remove redundant PCRE_STATIC definition (#18952)
Current minimum PCRE2 library in PHP is 10.30 (with bundled 10.45) and
none of these versions use PCRE_STATIC macro anymore in favor of
PCRE2_STATIC, which is defined in the generated config.w32.h on Windows.
2025-06-29 20:56:07 +02:00
Peter Kokot
93e3aca5fa Remove HAVE_INTMAX_T and SIZEOF_INTMAX_T (#18971)
The intmax_t is a C99 standard type defined in `<stdint.h>` and widely
available on current platforms. On Windows they are available as of
Visual Studio 2013. Using it conditionally as in these occurrences is
not needed anymore.
2025-06-29 19:50:27 +02:00
Niels Dossche
8d116a4ba1 Implement GH-15483: Use C23 memset_explicit() for ZEND_SECURE_ZERO() if available (#18713) 2025-06-29 14:29:28 +02:00
Peter Kokot
fffe642d67 Remove HAVE_PTRDIFF_T and SIZEOF_PTRDIFF_T (#18968)
The ptrdiff_t is a C89 standard type defined in `<stddef.h>` and widely
available on current platforms. Using it conditionally as in these
occurrences is not needed anymore.
2025-06-28 20:16:12 +02:00
DanielEScherzer
e98879f19c main.c: fix a typo, add some capitalization [skip ci] (#18905) 2025-06-26 10:52:33 -07:00
Tim Düsterhus
39cf27689b php_gdb: Print some numeric fields as hexadecimal (#18925)
* php_gdb: Print `zend_string*`’s `h` field as hexadecimal

A decimal representation of a hash value is not particularly meaningful and
makes it harder to compare hash values.

* php_gdb: Print `HashTable*`’s `nTableMask` field as hexadecimal
2025-06-24 15:22:25 +02:00
DanielEScherzer
ddd33fd7e4 Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Jakub Zelenka
89934b405e Merge branch 'PHP-8.4' 2025-06-21 20:17:15 +02:00
Jakub Zelenka
bbac59148c Merge branch 'PHP-8.3' into PHP-8.4 2025-06-21 20:16:13 +02:00
Jakub Zelenka
a36b8fdc94 Fix GH-13264: fgets() and stream_get_line() do not return false on filter fatal error
This happens because there are no checks in php_stream_fill_read_buffer
calls. This should not fail always but only on fatal error so special
flag is needed for that.

Closes GH-18778
2025-06-21 20:13:09 +02:00
Peter Kokot
49dd61906a Autotools: Move PHP_ODBC_* defines to configuration header (#15708)
The PHP_ODBC_* defines are remains of the PHP 2 and 3 era where the ODBC
functionality was part of the PHP core and was later moved to an
extension. This moves these defines to a regular PHP configuration
header (php_config.h) as done in other extensions.
2025-06-19 17:19:23 +02:00
Eric Mann
50606f8569 PHP 8.3 is now for PHP 8.3.24-dev 2025-06-17 08:06:35 -07:00
Saki Takamachi
a6749046f6 PHP-8.4 is now for PHP 8.4.10-dev 2025-06-17 21:05:02 +09:00
Niels Dossche
32c6ac9133 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix technically incorrect sizeof
2025-06-09 22:05:26 +02:00