1510 Commits
Author SHA1 Message Date
ndossche 7d3a57a858 Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
2026-10-26 19:24:21 +01:00
ndossche aad2266262 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
2026-10-26 19:24:16 +01:00
ndossche 61156b65c7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
2026-10-26 19:23:57 +01:00
ndosscheandDavid Carlier 470af312dd Fix GH-24697: cli: passing PHP_HTTP_PARSER_STRICT build option doesn't work
The default is non-strict, we need to keep the default for BC reasons.
We change the macro handling such that it can be enabled now, previously
it couldn't be enabled.

Closes GH-24704.

Co-authored-by: David Carlier <devnexen@gmail.com>
2026-10-26 19:23:38 +01:00
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
Ilia Alshanetsky 6507d8b33d Merge branch 'PHP-8.6'
* PHP-8.6:
  sapi/cli: Fix built-in server truncating responses after a partial write
2026-09-30 08:06:55 -04:00
Ilia Alshanetsky 31db39c96b Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  sapi/cli: Fix built-in server truncating responses after a partial write
2026-09-30 08:06:54 -04:00
Ilia Alshanetsky 1efdcc6b65 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  sapi/cli: Fix built-in server truncating responses after a partial write
2026-09-30 08:06:37 -04:00
Ilia Alshanetsky 021acbe980 sapi/cli: Fix built-in server truncating responses after a partial write
php_cli_server_content_sender_send() moved on to the next queued chunk
after a short send() of the current one. When that send() succeeded, its
bytes went out ahead of the current chunk's remainder, and the full-send
branch pointed buffer.first past both, unlinking the partially sent chunk.
The client received later chunks spliced into the body, the connection was
closed short of Content-Length, and the unsent remainder leaked. Stop at
the first partial write and resume from that chunk on the next POLLOUT.

Closes GH-23969
2026-09-30 07:38:49 -04:00
Calvin Buckley 20f4c4d605 sapi: Remove sapi_terminate_process (#23524)
This is unused; this is a vestige of 6c158374ba
and 45e327a672, which set up some timeout code
which was removed in 650c1c0a7d. Remove this
useless function from SAPIs.
2026-09-28 15:06:30 -03: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
ndossche 1051af314b Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix GH-23764: Built-in server leaks fd on HEAD request for static file
2026-09-22 17:41:52 +02:00
ndossche e039ee9231 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-23764: Built-in server leaks fd on HEAD request for static file
2026-09-22 17:41:31 +02:00
Jakub Skopal abdcfc38b4 Fix GH-23764: Built-in server leaks fd on HEAD request for static file
php_cli_server_begin_send_static() opens the file, but for HEAD requests
never stores the descriptor in client->file_fd, so nothing closes it.
Close it right away; Content-Length comes from the stat and the body is
never sent, so the descriptor is not needed.

Closes GH-23765.
2026-09-22 17:40:33 +02: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
Gina Peter Banyard a3fb5ecea9 Merge branch 'PHP-8.5' 2026-09-19 17:01:03 +01:00
Gina Peter Banyard 921c689868 Merge branch 'PHP-8.4' into PHP-8.5 2026-09-19 16:58:03 +01:00
tianfenghan 4e64a2655e Fix GH-22567 (Windows ZTS CLI SAPI should refresh its TSRMLS cache during request activation)
Closes GH-22568
2026-09-19 16:57:01 +01: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