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
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
b34ca99c94 Merge branch 'PHP-8.5' 2025-09-29 22:49:12 +01:00
David Carlier
ed9c1b87ee Merge branch 'PHP-8.4' into PHP-8.5 2025-09-29 22:48:55 +01: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
Daniel Scherzer
ea580760f0 Prepare for PHP 8.5.0RC1 2025-09-23 15:11:52 -04:00
Daniel Scherzer
a4c712c379 master is now for PHP 8.6.0-dev 2025-09-23 14:59:55 -04:00
Gina Peter Banyard
b4ed215299 core: Warn when non-representable floats are coerced to int (#19760)
RFC: https://wiki.php.net/rfc/warnings-php-8-5#casting_out_of_range_floats_to_int
2025-09-21 23:53:16 +01:00
Arnaud Le Blanc
ef9a89f7ec Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19480: error_log php.ini cannot be unset when open_basedir is configured
2025-09-19 18:13:55 +02: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
Tim Düsterhus
c89359164b main: Disable $_SERVER JIT when register_argc_argv=1 (#19833)
Fixes php/php-src#19823 and makes the deprecation more reliable by triggering
even when `$_SERVER` is not accessed.
2025-09-17 19:48:18 +02:00
Jakub Zelenka
1ac68e7b07 Fix GH-8157: post_max_size evaluates .user.ini too late in php-fpm
This introduces new SAPI callback that runs before post read

Closes GH-19333
2025-09-16 22:31:58 +02:00
Tim Düsterhus
26eac7de17 uri: Clean up naming of public symbols (#19794)
* uri: Rename `uri_recomposition_mode_t` to `php_uri_recomposition_mode`

* uri: Align the names of the `php_uri_recomposition_mode` values

* uri: Rename `uri_component_read_mode_t` to `php_uri_component_read_mode`

* uri: Align the names of the `php_uri_component_read_mode` values

* uri: Rename `uri_property_name_t` to `php_uri_property_name`

* uri: Align the names of the `php_uri_property_name` values

* uri: Rename `uri_property_handler_t` to `php_uri_property_handler`

* uri: Rename `uri_(read|write)_t` to `php_uri_property_handler_(read|write)`

* uri: Rename `php_uri_property_handler`’s `(read|write)_func` to `read|write`

The `_func` is implied by the data type and the name of the struct.

* uri: Rename `uri_parser_t` to `php_uri_parser`

* uri: Shorten the names of `php_uri_parser` fields

The `_uri` suffix is implied, because this is an URI parser.
2025-09-11 12:10:41 +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
Tim Düsterhus
37bf0ec961 main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string (#19606)
* main: Ignore `register_argc_argv` when `SG(request_info).argc` is available

* sapi: Remove hardcoded `register_argc_argv` for CLI SAPIs

This INI is ignored since the previous commit, which makes the hardcoded
setting obsolete.

* main: Deprecate deriving $_SERVER['argc'] and $_SERVER['argv'] from the query string

RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive

* main: Adjust deprecation message for `register_argc_argv`

* NEWS/UPGRADING
2025-09-09 10:34:35 +02:00
Alexandre Daubois
3f66cbeb4d Use zend_string API for mail.cr_lf_mode validation (#19759) 2025-09-09 10:18:42 +02:00
Niels Dossche
1869eff6ee Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix OSS-Fuzz #385993744
2025-09-08 19:10:46 +02: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
Alexandre Daubois
ae7def78fb Fix GH-19188: Add support for new INI mail.cr_lf_mode (#19238) 2025-09-08 09:58:27 +02:00
Niels Dossche
b5817cc4c3 Remove pointless zval_ptr_dtor() calls in userspace stream handling (#19712)
These act on LONGs, so dtor'ing them is pointless.
2025-09-07 13:26:20 +02:00
Niels Dossche
d0630e850b Avoid double conversion to string in php_userstreamop_readdir()
The string is converted twice for some reason.
This is pointless, and furthermore, this is observable in userspace code
when dealing with Stringable objects.

Closes GH-19713.
2025-09-04 23:14:22 +02:00
Niels Dossche
7e513a5101 Merge branch 'PHP-8.4'
* PHP-8.4:
  Remove incorrect call to zval_ptr_dtor() in user_wrapper_metadata()
2025-09-04 23:13:50 +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
Niels Dossche
4b99519eaa Fix GH-14506: Closing a userspace stream inside a userspace handler causes heap corruption
Use the PHP_STREAM_FLAG_NO_FCLOSE flag to prevent closing a stream while
a handler is running. We already do this in some other places as well.
Only handlers that do something with the stream afterwards need changes.

Closes GH-18797.
2025-09-04 22:05:20 +02:00
Joe Watkins
cb9af8d532 Revert "Remove include "sanity check" to get better error (#19650)"
This reverts commit ca4a841921.

We like the error message change, but not the downgrade to notice
at this time in the release cycle.

@bukka will come back around
2025-09-01 14:10:59 +02:00
Nikita Popov
ca4a841921 Remove include "sanity check" to get better error (#19650)
* Remove include "sanity check" to get a better error message

Instead of rejecting directories / non-regular files early with
a generic error, we should just accept them and error later when a
read is attempted. This is more general and will generate a better
error message on Linux. On Windows, the error remains the same as
before.

* Update error message to include include_path

fix format for include path

---------

Co-authored-by: Joe Watkins <krakjoe@php.net>
2025-08-31 14:52:53 +02:00
Tim Düsterhus
49faa4df75 uri: Always use const pointers when referring to uri_parser_t (#19623)
The actual parser definitions are all `const` and must never be modified. Make
sure to always use `const` pointers.
2025-08-30 21:04:50 +02:00
Tim Düsterhus
b27d91993d main: Change the register_argc_argv INI default to Off (#19473)
This partly implements the deprecation of the `register_argc_argv` INI setting
by updating the default value to ensure safe behavior when no INI file is
loaded. The actual deprecation warning will follow separately.

RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_register_argc_argv_ini_directive
2025-08-28 17:39:55 +02:00
Gina Peter Banyard
f4e2e91d4b core: Remove disable_classes INI setting
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#remove_disable_classes_ini_setting

This took longer to merge than expected but the initial motivation from 2 years ago still applied:

As described in the email to the PHP internals list [1] this feature is fundamentally broken and pointless.

Only internal classes can be disable which brings the following observation. On a minimal build of PHP, with only the mandatory extensions enabled, there are 148 classes/interfaces/traits defined. [2]

Other than the SPL ones (and even then), disabling any of these classes will cause issues within the engine.
Moreover, the SPL ones are not a security concern.

Therefore, any other class that can be disabled must come from an extension that can be disabled altogether. And "disabling" a class from an extension without disabling said extension will render it useless anyway.

If a hosting provided is concerned about an extension, then it should not enable it in the first place. Not break it ad hoc.

Considering the above, I cannot see how this functionality was ever useful.

This is in stark contrast to the disable_functions INI setting, which can be used to selectively remove functionality of an extension without breaking it overall.

What makes this setting particularly broken is that it does not unregister the class, it only overwrites the create CE handler to emit a warning and purge the properties and function hashtables. This leads to various use after free, segfaults, and broken expectations for the engine and extensions which define said classes. On top of that, it is possible to actually instantiate such a class (and even classes which actually disallow this like ext/imap) in userland, and pass it to function that are typed against said class without raising a TypeError. However, when trying to do anything with said object stuff is going to explode in countless ways.

[1] https://news-web.php.net/php.internals/120896
[2] https://gist.github.com/Girgias/63d55ba1e50b580412b004046daed02b
2025-08-25 21:16:55 +01:00
Jorg Adam Sowa
d6d0a2a217 remove safe_mode leftovers (#19552) 2025-08-24 03:55:15 +01:00
Máté Kocsis
e9c92a9739 ext/uri: Use the term "URI parser" instead of "URI handler" (#19530) 2025-08-21 07:23:47 +02:00
Máté Kocsis
1cff1815d0 Add internal URI handling API (#19073)
Part of https://github.com/php/php-src/pull/14461. Related to https://wiki.php.net/rfc/url_parsing_api.
2025-08-19 18:35:09 +02:00
Alexandre Daubois
a84a82ed88 Deprecate disabling report_memleaks INI directive (#19481)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_report_memleaks_ini_directive
2025-08-16 14:04:34 +02:00
Gina Peter Banyard
4d3ccc21d0 main: drop unnecessary zend_{try|catch} in user stream open wrapper
This was initially introduced with https://github.com/php/php-src/commit/9f86cdaf7fc4

However, this should also have been done for the opendir call.
This omission was found via OSS-Fuzz 51047 [1]
and fixed in a more general way in d0b3096ff0
by resetting `FG(user_stream_current_filename)` at the end of the request during shutdown.

As such this zend_try/zend_catch block is now unnecessary.

[1]: https://issues.oss-fuzz.com/issues/42515581
2025-08-15 18:41:17 +02:00
Gina Peter Banyard
0992265611 main: refactor userstream method calling
Closes GH-19312
2025-08-15 18:41:17 +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
Alexandre Daubois
dfa1307a64 Various return types and values consolidation (#19418) 2025-08-12 11:28:41 +01:00
Arnaud Le Blanc
b7ac56822d Fix build 2025-08-06 19:50:11 +02:00
Arnaud Le Blanc
3ddbad9589 Allocate a fast thread-safe-resource id for opcache
Closes GH-19347
2025-08-06 18:02:43 +02:00
Gina Peter Banyard
d9000b3094 tree: replace some unnecessary uses of spprintf (#19354) 2025-08-05 17:25:47 +01:00
Gina Peter Banyard
4d5bdef21a streams: refactor statbuf_from_array() 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
9e334af6e4 streams: use type php_socket_t instead of type int 2025-08-04 15:30:57 +01:00
Gina Peter Banyard
a02b2b8eb6 streams: use %zu printf specifier for size_t
Rather than casting to zend_long
2025-08-04 15:30:57 +01:00
Gina Peter Banyard
051414bec6 streams: use an enum for return type of _php_stream_make_seekable() 2025-08-04 15:30:57 +01:00