1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 16:22:37 +01:00
Commit Graph

1436 Commits

Author SHA1 Message Date
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
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
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
Shivam Mathur
a8bd3ba1bb Merge branch 'PHP-8.3' into PHP-8.4 2025-06-25 03:22:43 +05:30
Shivam Mathur
ac15486ae0 Fix CI for windows-2022
This is a continuation of GH-18927 to fix CI for windows-2022
2025-06-25 03:20:49 +05:30
Dmitry Stogov
ccc6c0f78c Fix GH-15709: Crashing tests on Windows x64 (#17095)
This is a quick fix for the problem.
It'll work while all the JIT-ed functions have the same "fixed stack frame".
Unwinder uses hard-coded unwind data for this "fixed stack frame".

* Preallocate space for Win64 shadow args

* typo

* Setup unwinder for JIT functions

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit 7cc327fd5a.

* Revert "Dynamically xfail test case which fails on CI"

This reverts commit bdde797159.

* Revert "Dynamically xfail test cases which fail on CI (GH-15710)"

This reverts commit 6d5962074f.

* Remove XFAIL sections

* Add hard-coded SEH unwind data for EXITCALL

* Fix unwind data

* Fix Windows multi-process support

* Typo
2024-12-13 02:05:45 +03:00
Christoph M. Becker
88acd91683 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
2024-12-04 20:47:11 +01:00
Christoph M. Becker
e50cf7a7a0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
2024-12-04 20:45:39 +01:00
Christoph M. Becker
e532d9afb5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
2024-12-04 20:44:47 +01:00
Christoph M. Becker
2285d7083e Revert "Enable GHSA-9pqp-7h25-4f32.phpt on Windows"
This reverts commit 7685fb0e1c.

The test fails at least for PHP-8.2+ on CI. Needs closer investigation.
2024-12-04 20:43:49 +01:00
Christoph M. Becker
fbba6df626 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Enable GHSA-9pqp-7h25-4f32.phpt on Windows
2024-12-04 19:05:49 +01:00
Christoph M. Becker
9c40bdaaf5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Enable GHSA-9pqp-7h25-4f32.phpt on Windows
2024-12-04 19:04:52 +01:00
Christoph M. Becker
c17b5bae8a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Enable GHSA-9pqp-7h25-4f32.phpt on Windows
2024-12-04 19:04:22 +01:00
Christoph M. Becker
7685fb0e1c Enable GHSA-9pqp-7h25-4f32.phpt on Windows
Closes GH-16933.
2024-12-04 19:03:42 +01:00
divinity76
c2d3734e89 Fix GH-15964: printf() can strip sign of -INF
We need to cater to negative infinity explicitly.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-15965.
2024-12-02 14:27:36 +01:00
Niels Dossche
c06a1a44f7 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16998: UBSAN warning in rfc1867
2024-12-01 11:00:17 +01:00
Niels Dossche
4eaa6f9d4e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16998: UBSAN warning in rfc1867
2024-12-01 10:59:59 +01:00
Niels Dossche
aab784263d Fix GH-16998: UBSAN warning in rfc1867
The "else branch" of `next_line` can reset the `buf_begin` field to
NULL, causing the next invocation to pass NULL to `memchr` with a 0
length. When UBSAN is enabled this causes an UBSAN abort. Real world
impact is likely none because of the 0 length.

To fix this, don't set the pointer to NULL, which means that the
`memchr` will return NULL and since
`self->bytes_in_buffer < self->bufsize` we return NULL and request more
data through `fill_buffer`. That function will reset `buf_begin` and
`bytes_in_buffer` so that the next invocation works fine.

I chose this solution so we have an invariant that `buf_begin` is never
NULL, which makes reasoning easier. An alternative solution is keeping
the NULLing of `buf_begin` and add an extra check at the top of
`next_line`, but I didn't like special casing this.

Closes GH-17000.
2024-12-01 10:59:30 +01:00
Ben Ramsey
d854a54b5f Merge branch 'PHP-8.3' into PHP-8.4 2024-09-26 14:24:13 -05:00
Ben Ramsey
6d99ccc268 Merge branch 'PHP-8.2' into PHP-8.3 2024-09-26 14:13:00 -05:00
Ben Ramsey
c259c9f3f6 Merge branch 'PHP-8.1' into PHP-8.2 2024-09-26 13:13:46 -05:00
Christoph M. Becker
05fce50f94 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
2024-09-26 15:35:42 +02:00
Christoph M. Becker
bf8c01db7f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
2024-09-26 15:34:34 +02:00
Christoph M. Becker
87d59d7fdd Fix GH-15905: Assertion failure for TRACK_VARS_SERVER
When the superglobals are eagerly initialized, but "S" is not contained
in `variables_order`, `TRACK_VARS_SERVER` is created as empty array
with refcount > 1.  Since this hash table may later be modified, a flag
is set which allows such COW violations for assertions.  However, when
`register_argc_argv` is on, the so far uninitialized hash table is
updated with `argv`, what causes the hash table to be initialized, what
drops the allow-COW-violations flag.  The following update with `argc`
then triggers a refcount violation assertion.

Since we consider `HT_ALLOW_COW_VIOLATION` a hack, we do not want to
keep the flag during hash table initialization, so we initialize the
hash table right away after creation for this code path.

Closes GH-15930.
2024-09-26 15:33:35 +02:00
Jakub Zelenka
4bcc7d5778 Skip GHSA-9pqp-7h25-4f32 test on Windows 2024-09-23 18:54:31 +01:00
Arnaud Le Blanc
d65a1e6f91 Fix GHSA-9pqp-7h25-4f32
multipart/form-data boundaries larger than the read buffer result in erroneous
parsing, which violates data integrity.

Limit boundary size, as allowed by RFC 1521:

    Encapsulation boundaries [...] must be no longer than 70 characters, not
    counting the two leading hyphens.

We correctly parse payloads with boundaries of length up to
FILLUNIT-strlen("\r\n--") bytes, so allow this for BC.
2024-09-23 11:23:13 +01:00
Michael Voříšek
d313ad6098 Deprecate E_STRICT constant and remove error level
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#remove_e_strict_error_level_and_deprecate_e_strict_constant

Closes GH-13053
2024-09-18 14:33:14 +02:00
Christoph M. Becker
6d5962074f Dynamically xfail test cases which fail on CI (GH-15710)
This is a stop-gap measure for GH-15709 to keep CI green.
2024-09-02 18:23:52 +02:00
Gina Peter Banyard
1e3d918936 ext/core: Deprecate passing E_USER_ERROR to trigger_error() (#15308)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
2024-08-09 15:51:07 +01:00
Christoph M. Becker
887e6b9c45 Fix GH-15181: Disabled output handler is flushed again
When an `PHP_OUTPUT_HANDLER_FAILURE` occurs, the output handler becomes
disabled (i.e. the `PHP_OUTPUT_HANDLER_DISABLED` flag is set).  However,
there is no guard for disabled handlers in `php_output_handler_op()`
what may cause serious issues (as reported, UB due to passing `NULL` as
the 2nd argument of `memcpy`, because the handler's buffer has already
been `NULL`ed).  Therefore, we add a respective guard for disabled
handlers, and return `PHP_OUTPUT_HANDLER_FAILURE` right away.

Closes GH-15183.
2024-08-06 16:45:51 +02:00
Niels Dossche
3ad9f4d441 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
2024-08-03 02:05:44 +02:00
Niels Dossche
9913b83ce5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
2024-08-03 02:05:35 +02:00
Niels Dossche
67ce8759e8 Fix GH-15179: Segmentation fault (null pointer dereference) in ext/standard/url_scanner_ex.re
Based on analysis by Ilija: https://github.com/php/php-src/issues/15179#issuecomment-2261546902

* Apply suggestions from code review

Closes GH-15206.

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-08-03 02:05:06 +02:00
Ilija Tovilo
780a8280d2 [RFC] Property hooks (#13455)
RFC: https://wiki.php.net/rfc/property-hooks

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2024-07-14 11:55:03 +02:00
Michael
6bb960092a [skip ci] Fix some typos (#14893) 2024-07-10 00:11:36 +01:00
Calvin Buckley
64c7c4c33c Merge branch 'PHP-8.3'
* PHP-8.3:
  Declare that this test needs iconv extension
2024-07-08 18:39:36 -03:00
Calvin Buckley
192c102bde Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Declare that this test needs iconv extension
2024-07-08 18:38:59 -03:00
Calvin Buckley
43e3f577b9 Declare that this test needs iconv extension
Otherwise it would fail with the usual recommended ./configure
invocation used for RMs testing (i.e. --disable-all).
2024-07-08 18:37:52 -03:00
Niels Dossche
279d82bb07 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
2024-07-04 15:50:44 +02:00
Niels Dossche
519c435fc6 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
2024-07-04 15:50:32 +02:00
Niels Dossche
89c3e0346a Fix GH-14808: Unexpected null pointer in Zend/zend_string.h with empty output buffer
The output buffer can be NULL when the number of bytes is zero.

Closes GH-14815.
2024-07-04 15:49:58 +02:00
Peter Kokot
c44834d8ad Trim trailing whitespace (#14721) 2024-06-29 18:41:45 +02:00
Niels Dossche
f20707491e Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix Windows SKIPIF (#14219)
2024-05-13 22:10:53 +02:00
Niels Dossche
f16e712327 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix Windows SKIPIF (#14219)
2024-05-13 22:10:42 +02:00
Niels Dossche
719fa46150 Fix Windows SKIPIF (#14219)
PHP_OS_FAMILY never has the value WIN, for Windows platforms it is the
string "Windows". As such, this test was never executed. Fix this.
2024-05-13 22:09:47 +02:00
Máté Kocsis
2079da0158 Fix #13865 Improve parameter and return value related deprecation messages (#13913)
I added the function/method name to some compile-time deprecation messages which are related to parameters/return values. Consistently with the other similar error messages, I included the function/method name at the start of the message.
2024-04-08 22:20:32 +02:00
Máté Kocsis
330cc5cdb2 Deprecate implicit nullable parameter types (#12959)
RFC: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-03-13 21:40:26 +01:00
haszi
3ce7bf2a77 Clear handler status flag in handler init
Closes GH-13087
2024-02-09 12:00:56 +00:00