527 Commits
Author SHA1 Message Date
Ilija Tovilo 9705fda1bb Merge branch 'PHP-8.6' into master
* PHP-8.6:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:34:56 +02:00
Ilija Tovilo d6373dfe15 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:33:23 +02:00
Ilija Tovilo c7273b9ba8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:30:04 +02:00
Ilija Tovilo 8a94bb3822 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:27:03 +02:00
Ilija Tovilo c1a5f468d0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:12:35 +02:00
3584a98bda Avoid state corruption via bailout
- Replace bailout on OOM with UnwindExit
- Properly reset various globals that may be accessed during startup

Fix GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
Fix GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Jakub Zelenka <bukka@php.net>
Co-authored-by: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2026-10-21 16:06:22 +02:00
Daniel Scherzer 1979890d21 Merge branch 'PHP-8.6'
* PHP-8.6:
  SoapClient: add new `keep_headers` option
  ext/soap: redact more sensitive headers
  `sdl_set_uri_credentials()`: use early returns to improve readability
  GH-23686: Add regression tests for sensitive headers
2026-10-19 15:34:13 -07:00
Daniel Scherzer 1e8e679dd4 GH-23686: Add regression tests for sensitive headers 2026-10-19 14:33:07 -07:00
Gina Peter Banyard c43f5a60b3 Merge branch 'PHP-8.6'
* PHP-8.6:
  Update NEWS
  ext/standard/tests: work around Windows quoting with tempfiles.
  .github/scripts/windows: pass an extension_dir to the test runner.
  {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
  ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
  sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
  std: Fix memory leak of the last response headers after a nested HTTP request (#24201)
  Fiber: hold the object a callable resolved to in the creating frame (#24134)
2026-10-14 18:43:58 +01:00
Gina Peter Banyard 3e458e5fdc Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Update NEWS
  ext/standard/tests: work around Windows quoting with tempfiles.
  .github/scripts/windows: pass an extension_dir to the test runner.
  {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
  ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
  sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
  std: Fix memory leak of the last response headers after a nested HTTP request (#24201)
  Fiber: hold the object a callable resolved to in the creating frame (#24134)
2026-10-14 18:43:37 +01:00
Gina Peter Banyard b1a3a4e082 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update NEWS
  ext/standard/tests: work around Windows quoting with tempfiles.
  .github/scripts/windows: pass an extension_dir to the test runner.
  {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
  ext/standard/tests: pass TEST_PHP_EXTRA_ARGS to some proc_open() tests
  sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
  std: Fix memory leak of the last response headers after a nested HTTP request (#24201)
  Fiber: hold the object a callable resolved to in the creating frame (#24134)
2026-10-14 18:39:38 +01:00
Michael Orlitzky b9f41139cf {ext/standard,sapi/cli}/tests: pass TEST_PHP_EXTRA_ARGS to php
Several of these tests fail to pass TEST_PHP_EXTRA_ARGS to
the PHP binary they execute. This can lead to spurious failures when,
for example, the system's INI file is incompatible with the just-built
CLI php:

  ---- EXPECTED OUTPUT
  int(111)
  ---- ACTUAL OUTPUT
  Failed loading /usr/lib64/php8.2/lib64/opcache.so:
  /usr/lib64/php8.2/lib64/opcache.so: undefined symbol: _emalloc_32
  int(111)
  ---- FAILED

This commit adds TEST_PHP_EXTRA_ARGS to the "php" invocations that are
missing them, allowing the user to run "run-tests.php -n" to work
around the problem.
2026-10-14 18:34:08 +01:00
Michael Orlitzky c522554a02 sapi/cli/tests/023.phpt: support TEST_PHP_EXTRA_ARGS
This test runs the PHP test executable from the command-line, but was
not passing TEST_PHP_EXTRA_ARGS to it from run-tests.php. This commit
adds the args, but also updates the test case.

This test relies on memory_limit being updated by an INI file
(generated on-the-fly), but by default, run-tests.php overrides PHP's
memory_limit using TEST_PHP_EXTRA_ARGS. So if we pass the extra args
to PHP, then the memory limit will be constant. To work around that,
we switch to using max_input_vars (as opposed to memory_limit) inside
the test.
2026-10-14 18:34:07 +01:00
David Carlier 83b6359775 Merge branch 'PHP-8.6' 2026-10-07 07:58:50 +01:00
David Carlier 89e957fd54 Merge branch 'PHP-8.5' into PHP-8.6 2026-10-07 07:58:49 +01:00
David Carlier aebd3ee47d Merge branch 'PHP-8.4' into PHP-8.5 2026-10-07 07:58:48 +01:00
lazerg c88c89e351 Fix GH-24139: NULL dereference in php_ini.c when expand_filepath() fails
Close GH-24141
2026-10-07 07:57:48 +01:00
Gina Peter Banyard 344a925015 Merge branch 'PHP-8.6'
* PHP-8.6:
  ext/curl/config.m4: include string.h for test using strncmp()
  ext/soap/tests/bugs/bug62900.phpt: make use of TEST_PHP_ vars
  sapi/cli/tests/php_cli_server_ipv6_error_message.phpt: use TEST_PHP_ vars
2026-09-30 15:57:18 +01:00
Gina Peter Banyard acd290ef1f Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  ext/curl/config.m4: include string.h for test using strncmp()
  ext/soap/tests/bugs/bug62900.phpt: make use of TEST_PHP_ vars
  sapi/cli/tests/php_cli_server_ipv6_error_message.phpt: use TEST_PHP_ vars
2026-09-30 15:56:59 +01:00
Gina Peter Banyard 5b9cb8101c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/soap/tests/bugs/bug62900.phpt: make use of TEST_PHP_ vars
  sapi/cli/tests/php_cli_server_ipv6_error_message.phpt: use TEST_PHP_ vars
2026-09-30 15:56:17 +01:00
Michael Orlitzky 17506567b9 sapi/cli/tests/php_cli_server_ipv6_error_message.phpt: use TEST_PHP_ vars
When invoking the PHP in a subprocess, TEST_PHP_EXECUTABLE_ESCAPED is
preferable to PHP_BINARY, because the former can be set to ensure that
the just-built (often development) php gets used rather than a system
install. In addition, TEST_PHP_EXTRA_ARGS should be passed to this
interpreter.

Closes GH-22414
2026-09-30 15:55:14 +01:00
David Carlier 497fdf254e [skip ci] sapi/cli: Wait for the connection in Expect 100-continue abort test
The test resets the connection as soon as it is opened, so the reset could
reach the server while the connection was still in the listen backlog. The
server then never saw the request and the expected error was never logged.

Complete a request on a second connection first: the accept queue is FIFO,
so a response on the later connection means the earlier one has been
accepted, and the reset is guaranteed to hit an established connection.

Close GH-23841
2026-09-26 20:38:21 +01:00
David Carlier 7e0b2e044c Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  sapi/cli: Fix crash in the CLI server when a client is reset before being accepted
  ext/curl: Preserve callback lifetime without rejecting callback changes (#23863)

# Conflicts:
#	ext/curl/interface.c
2026-09-24 11:02:56 +01:00
David Carlier b0ea8b2537 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  sapi/cli: Fix crash in the CLI server when a client is reset before being accepted
  ext/curl: Preserve callback lifetime without rejecting callback changes (#23863)
2026-09-24 11:02:50 +01:00
David Carlier 83c59b8053 sapi/cli: Fix crash in the CLI server when a client is reset before being accepted
accept() can return a socket without filling in the peer address when the
client has already reset the connection.  The address buffer was left
uninitialized and php_network_populate_name_from_sockaddr() does not set the
output string for an unknown family, so zend_string_dup() was handed a NULL.

Zero the buffer and fall back to "-" when the address is unknown.

Close GH-23840
2026-09-24 10:56:42 +01:00
Daniel Scherzer 0da9d196b1 Reflection: print boolean constant values as true and false
Updates the output of `ReflectionClassConstant::__toString()` and
`ReflectionConstant::__toString()`, as well as the other ways that class
constants are printed, e.g. `ReflectionClass::__toString()`.
2026-09-22 13:24:10 -07:00
Daniel Scherzer ed8ff1ec53 CLI server: remove "Host" header reflection from response
The server previously responded with a copy of the requested "Host" header in
the response, without any validation. That header, as defined in RFC 9110, is
intended for use in *requests*; remove it from the responses.
2026-09-20 15:35:15 -07:00
Daniel Scherzer 5bebadbc89 CLI server: add regression tests for "Host" header reflection
The server responds with a "Host" header that is copied from the request, add a
test so that when the behavior changes it is visible.
2026-09-20 15:35:14 -07:00
Sjoerd Langkemper b8c43c35d1 sapi/cli: support Expect 100-continue in PHP dev server
When posting large payloads, curl checks whether the server is ready for
the body. It sends an `Expect: 100-continue` header and expects
`HTTP/1.1 100 Continue` as the response before sending the body. The PHP
development server did not support this, causing a timeout in curl. This
made such requests take one second longer.

HTTP/1.0 does not support this, so the response is only sent when the
request is HTTP/1.1.

- https://everything.curl.dev/http/post/expect100.html
- https://github.com/php/php-src/issues/23242

Fix GH-23242
Close GH-23245
2026-08-25 19:51:29 +01:00
David Carlier 74d49165e4 Merge branch 'PHP-8.5'
* PHP-8.5:
  sapi/cli: check php_cli_server_client_send_through() return value
2026-08-24 17:00:00 +01:00
David Carlier 4ddced0e4f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  sapi/cli: check php_cli_server_client_send_through() return value
2026-08-24 16:57:31 +01:00
Lazizbek Ergashev 6748db3ff5 sapi/cli: check php_cli_server_client_send_through() return value
sapi_cli_server_send_headers() sent the header buffer through
php_cli_server_client_send_through() but dropped the return value, so it
always reported SAPI_HEADER_SENT_SUCCESSFULLY, even when the send failed
and php_handle_aborted_connection() did not bail out (ignore_user_abort=1).
It now compares the send result against the buffer length and returns
SAPI_HEADER_SEND_FAILED when it comes up short.

php_cli_server_client_send_through() itself returned the number of bytes
left on failure, which equals str_len when nothing was sent: the same
value it returns on success. It now returns the number of bytes actually
sent on both paths.

Since sapi_send_headers() resets headers_sent on SAPI_HEADER_SEND_FAILED,
a headers_written flag on the client guards against rebuilding and
resending the whole header block on every subsequent output write.

Close GH-23428
2026-08-24 16:57:24 +01:00
NickSdot 2b57e3b358 fix: flaky cli server when parallel (#23238) 2026-08-13 18:45:02 +02:00
NickSdot 1d2ea5ce22 Run tests in parallel by default (#22939)
Runs the test suite in parallel by default; automatically selects up to 10 workers. Explicit -j1 remains the opt-out to run tests serial. Smaller batches improve balancing.
2026-08-10 11:33:43 +02:00
NickSdot c4c76bf115 sapi/cli: applied fixers to improve test robustness (#23137)
Extracted from: #22799
Removes the duplicated empty line to follow the "last empty line" rule.
2026-08-09 01:27:23 +08:00
Ilia Alshanetsky 454f1a61b7 sapi/cli: guard Content-Length overflow and enforce post_max_size (#22017)
The dev server's HTTP parser accumulates Content-Length digits into an
ssize_t without an overflow check; a 30-digit value wraps and the
consumer aborts on pemalloc. Guard the decimal and chunked-size
accumulators against SSIZE_MAX, then reject in on_headers_complete when
the parsed length exceeds post_max_size and reply 413 with the
configured limit in the body.

A chunked request carries no Content-Length, so enforce the same limit
as the chunks accumulate in on_body, and honour a non-zero return from
that callback in the parser. The body buffer was reserved from the
declared length and resized down to the bytes in hand on the next line,
so a chunk header of 7FFFFFFFFFFFFF aborted the server for no gain; grow
it from the received length instead. A parse error between a header name
and its value left the copied name owned by nobody; release both header
strings in php_cli_server_client_dtor().

Fixes GH-22003
2026-08-05 12:08:36 -04:00
Gina Peter Banyard 34c686a5b4 stream: remove path parameter in stream error functions (#22792)
Instead rely on the mechanism gated by the error_include_args INI to display them.

This actually aligns the behaviour of what was accepted in https://wiki.php.net/rfc/display_error_function_args.
2026-07-19 16:15:01 +01:00
Vazha AptsiauriandVazha Aptsiauri 35881e1298 sapi/cli: support HTTP QUERY method in built-in server (#22615)
Co-authored-by: Vazha Aptsiauri <v.aptsiauri@tnet.ge>
2026-07-08 15:10:01 +01:00
Gina Peter Banyard 9f96285f2a win32/signal.c: convert ctrl_handler to FCC (#22210) 2026-06-03 14:11:26 +01:00
Calvin BuckleyandTim Düsterhus a22c56c969 Add error_include_args INI option to display function args in docref (#12276)
Displays arguments for errors from built-in PHP functions using docref API.

RFC: https://wiki.php.net/rfc/display_error_function_args

Co-authored-by: Tim Düsterhus <tim@bastelstu.be>
2026-06-01 18:01:09 -03:00
Ilija Tovilo e27667b8a3 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix gh21901.phpt expected output when no ini file is loaded
2026-05-01 19:24:03 +02:00
Ilija Tovilo e3845851d3 Fix gh21901.phpt expected output when no ini file is loaded 2026-05-01 19:23:09 +02:00
Ilija Tovilo 9258123d6a Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix stale getopt() optional value in CLI
2026-05-01 18:57:35 +02:00
onthebedandIlija Tovilo 893bc0ad6e Fix stale getopt() optional value in CLI
Technically this applies to other SAPIs, but CLI is currently the only one with
a flag with an optional value. The PHP getopt() implementation already clears
php_optarg by-hand.

Fixes GH-21901
Closes GH-21902

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2026-05-01 18:56:57 +02:00
Daniel Scherzer be67a37d02 Merge branch 'PHP-8.5'
* PHP-8.5:
  GH-21754: sapi/cli: avoid deprecation messages with `--rf` and methods (#21758)
2026-04-15 08:53:34 -07:00
Daniel Scherzer 1c6c7bc9da Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  GH-21754: sapi/cli: avoid deprecation messages with `--rf` and methods (#21758)
2026-04-15 08:53:01 -07:00
Daniel Scherzer fbd3017511 GH-21754: sapi/cli: avoid deprecation messages with --rf and methods (#21758) 2026-04-15 08:49:37 -07:00
Ben Ramsey 06b3376eb3 license-update: revise license statement in phpinfo
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Ben Ramsey e4394946c2 license-update: update Zend copyright name
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Ben Ramsey cc4ce2b42e license-update: remove copyright years from info output
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00