Commit Graph

5658 Commits

Author SHA1 Message Date
Sara Golemon
ac508301c9
Bump for 8.0.27 2022-11-08 22:10:29 +00:00
Benoit
994097093c Fix compilation warning 2022-10-22 10:41:02 +02:00
Arnaud Le Blanc
80232de0e4
Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Derick Rethans
def8c8d174 Merge branch 'PHP-7.4' into PHP-8.0 2022-09-27 14:11:14 +01:00
Sara Golemon
559da529a0
Bump for 8.0.25 2022-09-13 23:46:26 +00:00
Dmitry Stogov
d0b3096ff0 Reset FG(user_stream_current_filename) at the end of request
Attempt to fix oss-fuzz #51047
2022-09-12 11:38:31 +03:00
Derick Rethans
0611be4e82 Fix #81727: Don't mangle HTTP variable names that clash with ones that have a specific semantic meaning. 2022-09-09 17:10:04 +01:00
Sara Golemon
3d6ed8c852
Catch up dev version numbers 2022-08-30 12:15:27 +00:00
Jakub Zelenka
3503b1daa2
Fix bug #77780: "Headers already sent" when previous connection was aborted
This change primarily splits SAPI deactivation to module and destroy
parts. The reason is that currently some SAPIs might bail out
on deactivation. One of those SAPI is PHP-FPM that can bail out on
request end if for example the connection is closed by the client
(web sever). The problem is that in such case the resources are not
freed and some values reset. The most visible impact can have not
resetting the PG(headers_sent) which can cause erorrs in the next
request. One such issue is described in #77780 bug which this fixes
and is also cover by a test in this commit. It seems reasonable
to separate deactivation and destroying of the resource which means
that the bail out will not impact it.
2022-08-29 22:25:53 +01:00
twosee
b8d07451d4
Re-fix GH-8409: SSL handshake timeout persistent connections hanging
This fix is another solution to replace d0527427be, use zend_try and zend_catch to make sure persistent stream will be released when error occurred.

Closes GH-9332.
2022-08-14 20:13:36 +08:00
Jakub Zelenka
d9ff5e079f
Fix GH-8472: stream_socket_accept result may have incorrect metadata 2022-08-07 14:17:38 +01:00
Christoph M. Becker
77e954afaa
Fix GH-8923: error_log on Windows can hold the file write lock
On Windows, closing a file which is locked may not immediately remove
the lock.  The `LockFileEx()` documentation states:

| Therefore, it is recommended that your process explicitly unlock all
| files it has locked when it terminates.

We comply, and also use the macro `LOCK_EX` instead of the magic number
`2`.

Closes GH-8925.
2022-07-12 13:36:20 +02:00
Heiko Weber
93a44f8c50
Fix potential use after free in php_binary_init()
Closes GH-8791.
2022-06-20 12:00:50 +02:00
Jakub Zelenka
e330f443c9
Fix bug #67764: fpm: syslog.ident does not work 2022-06-19 20:05:49 +01:00
Dmitry Stogov
0b8e471b3c Fix use after free
This fixes oss-fuzz #47997
2022-06-14 12:44:37 +03:00
Derick Rethans
8fbeadcd45 Bump version in 7.4 to 7.4.31-dev 2022-06-07 09:48:06 +01:00
Sara Golemon
e05897fe5e
Bump for 8.0.21 2022-05-24 18:51:01 +00:00
Jakub Zelenka
23a2030438 Fix bug #72185: php-fpm writes empty fcgi record causing nginx 502
This issue might happen if there is change of the fcgi stream when
the buffer is full. Then the empty record is created which signals
end of stream which is incorrect.

The actual fix without a test was contributed by GitHub user @loveharmful
in GH-3198.
2022-05-10 21:36:55 +01:00
Bernd Holzmüller
84c18f9f04
Preserve file-position when php://temp switches to temporary file
Closes GH-8333.
2022-04-11 12:31:22 +02:00
Christoph M. Becker
43f3745abb
Bump version
Apparently, this has been forgotten when PHP 8.0.17RC1 and 8.0.18RC1
had been tagged.

We also fix the version of the fix for GH-8253, which didn't make it
into PHP 8.0.18RC1.
2022-04-05 13:19:02 +02:00
Bob Weinand
e6cf583160 Fix GH-8082: Prevent leaking memory on observed transient run_time_caches
This is achieved by tracking the observers on the run_time_cache (with a fixed amount of slots, 2 for each observer).
That way round, if the run_time_cache is freed all associated observer data is as well.

This approach has been chosen, as to avoid any ABI or API breakage.
Future versions may for example choose to provide a hookable API for run_time_cache freeing or similar.
2022-03-01 14:49:44 +01:00
Sara Golemon
8a46311dbd
Bump for 8.0.17-dev 2022-02-02 23:44:02 +00:00
Christoph M. Becker
93a3c71eb4
Fix GH-7896: Environment vars may be mangled on Windows
When bug 77574[1] has been fixed, the fix only catered to variables
retrieved via `getenv()` with a `$varname` passed, but neither to
`getenv()` without arguments nor to the general import of environment
variables into `$_ENV` and `$_SERVER`.  We catch up on this by using
`GetEnvironmentStringsW()` in `_php_import_environment_variables()` and
converting the encoding to whatever had been chosen by the user.

[1] <https://bugs.php.net/bug.php?id=75574>

Closes GH-7928.
2022-01-17 23:44:41 +01:00
Sara Golemon
999c6f2c5d
Bump for 8.0.15 2021-12-02 05:09:07 +00:00
Christoph M. Becker
f3bd24a200
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81659: stream_get_contents() may unnecessarily overallocate
2021-11-29 14:48:11 +01:00
Christoph M. Becker
31749aac62
Fix #81659: stream_get_contents() may unnecessarily overallocate
Since we're going to read from the current stream position anyway, the
`max_len` should be the size of the file minus the current position
(still catering to potentially filtered streams).  We must, however,
make sure to cater to the file position being beyond the actual file
size.

While we're at, we also fix the step size in the comment, which is 8K.

A further optimization could be done for unfiltered streams, thus
saving that step size, but 8K might not be worth it.

Closes GH-7693.
2021-11-29 14:46:09 +01:00
Nikita Popov
4c171ed5eb Fix bug #81591: ignore_repeated_errors broken
We should suppress the error if the message is the same, not if
it's different. Apparently we had no test coverage for these
options.
2021-11-04 16:23:55 +01:00
Derick Rethans
05b212bb3d Prepare for 7.4.27 2021-11-02 16:39:44 +00:00
Sara Golemon
2d4bfcfd3b
Prep for 8.0.14 2021-11-02 15:55:12 +00:00
Christoph M. Becker
b7f3b67060
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81518: Header injection via default_mimetype / default_charset
2021-10-14 12:21:35 +02:00
Christoph M. Becker
365769366b
Fix #81518: Header injection via default_mimetype / default_charset
We forbid setting these INI options to values containing NUL bytes, CR
or LF.

Closes GH-7574.
2021-10-14 12:16:19 +02:00
Derick Rethans
9733d49e14 Remove now superfluous tests due to changes in tzdata 2021-10-08 13:51:21 +01:00
Christoph M. Becker
e2d9ca7b19
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81475: stream_isatty emits warning with attached stream wrapper
2021-09-29 13:47:13 +02:00
Christoph M. Becker
23e13e2c8f
Fix #81475: stream_isatty emits warning with attached stream wrapper
We must not issue warnings, if `show_err` is false.

Closes GH-7513.
2021-09-29 13:44:09 +02:00
Nikita Popov
2f798d99b7 Fix leak of invalid stream_read() return value
Fixes oss-fuzz 6225190686687232 (part of #38542).
2021-09-28 15:57:55 +02:00
Sara Golemon
5e1e4a8963
Prep for 8.0.12 2021-09-07 15:16:11 +00:00
Christoph M. Becker
a2b92d6baa
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81346: Non-seekable streams don't update position after write
2021-08-10 16:50:36 +02:00
Christoph M. Becker
4a1af1f871
Fix #81346: Non-seekable streams don't update position after write
The stream position is not related to the buffer, and needs to be
updated for non-seekable streams as well.  The erroneous condition
around the position update is a relict of an old commit[1].

The unexpected test expectation is due to bug #81345.

[1] <088e2692c3>

Closes GH-7356.
2021-08-10 16:49:07 +02:00
Christoph M. Becker
2e71c94c9b
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81302: Stream position after stream filter removed
2021-08-10 16:41:14 +02:00
Christoph M. Becker
40b31fcc80
Fix #81302: Stream position after stream filter removed
When flushing the stream filters actually causes data to be written to
the stream, we need to update its position, because that is not done by
the streams' write methods.

Closes GH-7354.
2021-08-10 16:39:55 +02:00
Christoph M. Becker
bf9afc184f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81294: Segfault when removing a filter
2021-07-27 12:14:22 +02:00
Christoph M. Becker
1fa26eccba
Fix #81294: Segfault when removing a filter
We need to call the proper method.

Closes GH-7308.
2021-07-27 12:12:02 +02:00
Christoph M. Becker
c6b7f6c39f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #72595: php_output_handler_append illegal write access
2021-07-15 15:29:48 +02:00
Christoph M. Becker
a942cf5b02
Fix #72595: php_output_handler_append illegal write access
We must make sure that `handler->buffer.size + grow_max` does not
overflow, so we're using `safe_erealloc()` instead.

Closes GH-7241.
2021-07-15 15:26:42 +02:00
Sara Golemon
7dc35ac8a7
Bump to 8.0.10 2021-07-13 14:10:35 +00:00
Nikita Popov
65bd8d281f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80728: Don't reset the timeout on ini deactivate
2021-06-29 16:37:27 +02:00
Calvin Buckley
98a21d1dfb Fix bug #80728: Don't reset the timeout on ini deactivate
When the time limit for a script is changed, when the script ends,
its INI value will be reset. This calls the event handler for the
timeout change, which will unset then reset the timeout. However,
this is done even if the script is done executing, and say, the CGI
or CLI web server process is idle.

This is probably incorrect, but isn't a problem on most platforms,
because PHP uses a timer that only ticks when the process is active
(that is, executing code). Since when it's idle, it's blocking on
listen/read, it won't tick because nothing executes. However, on
platforms where only the real-time timer is supported, (Cygwin/PASE)
it ticks regardless of if PHP is even executing. This means that the
idle processes are subject to timeouts from the INI reset on script
end.

This makes it so the timer is never set if the state is deactivating.
Testing with the CLI web server indicates the timer no longer
spuriously activates under PASE.

Closes GH-6683.
2021-06-29 16:36:46 +02:00
Christoph M. Becker
8daed6d0f2
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81145: copy() and stream_copy_to_stream() fail for +4GB files
2021-06-17 13:16:30 +02:00
Christoph M. Becker
2555efadbc
Fix #81145: copy() and stream_copy_to_stream() fail for +4GB files
When mapping the file, we need to pass the proper `dwFileOffsetHigh`
instead of `0`.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>

Closes GH-7158.
2021-06-17 13:13:47 +02:00
Gabriel Caruso
b81c3b5b1c
Prepare for PHP 8.0.9 2021-06-15 09:19:13 +02:00