Commit Graph

13399 Commits

Author SHA1 Message Date
Christoph M. Becker
465b3ab2f9
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78819: Heap Overflow in msg_send
2021-08-18 16:37:58 +02:00
Christoph M. Becker
9494b1cdc4
Fix #78819: Heap Overflow in msg_send
We need to use the proper type.

Closes GH-7386.
2021-08-18 16:35:16 +02:00
Christoph M. Becker
d71a0dcc76
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73122: Integer Overflow when concatenating strings
2021-08-18 14:52:59 +02:00
Christoph M. Becker
0b7dffb41f
Fix #73122: Integer Overflow when concatenating strings
We must avoid integer overflows in memory allocations, so we introduce
an additional check in the VM, and bail out in the rare case of an
overflow.

Closes GH-7381.
2021-08-18 14:49:09 +02:00
Christoph M. Becker
e45a063f4b
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #71542: disk_total_space does not work with relative paths
2021-08-17 11:31:14 +02:00
Christoph M. Becker
f924e97269
Fix #71542: disk_total_space does not work with relative paths
For ZTS builds, we need to expand the path given to `disk_free_space()`
and `disk_total_space()` to properly support the VCWD.

Closes GH-7377.
2021-08-17 11:29:33 +02:00
Nikita Popov
47ccdecf00 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81353
2021-08-16 15:04:57 +02:00
Nikita Popov
d1e956ff31 Fixed bug #81353
A user-defined error handler should not be invoked for preload
warnings. We are in a partially shut-down state at that point.
2021-08-16 15:04:17 +02:00
Christoph M. Becker
2c6177a4a8
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81351: xml_parse may fail, but has no error code
2021-08-13 17:37:36 +02:00
Christoph M. Becker
80a377e69b
Fix #81351: xml_parse may fail, but has no error code
The fix for bug #73151[1] cured the symptoms, but not the root cause,
namely xmlParse() must not be called recursively.  Since that bugfix
also messed up the error handling, we basically revert it (but also
simplify the return), and then prevent calling the parser recursively.

[1] <f2a8a8c068>

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

Closes GH-7363.
2021-08-13 17:33:58 +02: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
Gabriel Caruso
00bb7c97f8
Prepare for PHP 8.0.11 2021-08-10 11:46:56 +02:00
Derick Rethans
79d564a8cc Prepare for 7.4.24 2021-08-10 10:14:36 +01:00
Christoph M. Becker
606829f31f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74544: Integer overflow in mysqli_real_escape_string()
2021-08-10 00:06:58 +02:00
Christoph M. Becker
5977610de1
Fix #74544: Integer overflow in mysqli_real_escape_string()
The patch has been provided by @johannes.

Closes GH-7353.
2021-08-10 00:05:39 +02:00
Derick Rethans
4aeff60f34 Upgrade timelib to version 2020.03 2021-08-08 12:11:18 +01:00
Christoph M. Becker
5628afb782
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81327: Error build openssl extension on php 7.4.22
2021-08-04 18:44:06 +02:00
Christoph M. Becker
6724d5d4c2
Fix #81327: Error build openssl extension on php 7.4.22
The recent fix for bug 52093 is not compatible with LibreSSL ≥ 2.7.0,
which we recognize as mostly OpenSSL 1.1.0 compatible, but they still
do not support `ASN1_INTEGER_set_int64()`.

Closes GH-7339.
2021-08-04 18:41:04 +02:00
Christoph M. Becker
213ad544e4
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51498: imagefilledellipse does not work for large circles
2021-08-03 16:20:16 +02:00
Christoph M. Becker
c565555f03
Fix #51498: imagefilledellipse does not work for large circles
We backport the respective upstream fix[1].

[1] <ace7fd88dc>

Closes GH-7329.
2021-08-03 16:17:47 +02:00
Remi Collet
35c3e0b1a4
NEWS 2021-08-03 12:07:46 +02:00
Christoph M. Becker
4645a9d10f
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
2021-07-29 13:28:52 +02:00
Christoph M. Becker
d1ccb5bd0c
Fix #81305: Built-in Webserver Drops Requests With "Upgrade" Header
While our HTTP parser supports upgrade requests, the code using it does
not.  Since upgrade requests are only valid for HTTP/1.1 and we neither
support any higher version, nor HTTPS yet, we do not exit early in case
of such requests, i.e. we ignore them, what is allowed by the specs.

We keep the supporting code in case we can meaningfully support upgrade
requests in the future.

Closes GH-7316.
2021-07-29 13:16:15 +02:00
Christoph M. Becker
3244e0785d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
2021-07-28 10:53:27 +02:00
Christoph M. Becker
98049e8b9a
Fix #81252: PDO_ODBC doesn't account for SQL_NO_TOTAL
If `P->len` is negative (not only when it is `SQL_NULL_DATA`), we must
not go on, because the following code can't deal with that.  This means
that the output parameter will be set to `NULL` without any indication
what went wrong, but it's still better than crashing.

Closes GH-7295.
2021-07-28 10:51:38 +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
71879d385e
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81283: shmop can't read beyond 2147483647 bytes
2021-07-23 17:49:56 +02:00
Christoph M. Becker
387c0de983
Fix #81283: shmop can't read beyond 2147483647 bytes
`start`, `count` and `shmop->size` are `zend_long`, so we must not
restrict to `INT_MAX`.

Closes GH-7301.
2021-07-23 17:46:42 +02:00
Nikita Popov
90ee1c36d7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #66719
2021-07-23 11:24:59 +02:00
Nikita Popov
dfd05da97f Fix bug #66719
While parent:: should inherit the called scope, it should only do
so if it is compatible. If there is no called scope, or it is not
a subtype of the scope, we should fall back to the scope.
2021-07-23 11:24:22 +02:00
Dmitry Stogov
053c56f52e Fixed bug #81226 (Integer overflow behavior is different with JIT enabled) 2021-07-21 19:28:43 +03:00
Christoph M. Becker
f03e7c845e
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74960: Heap buffer overflow via str_repeat
2021-07-21 15:33:17 +02:00
Christoph M. Becker
760ff841a1
Fix #74960: Heap buffer overflow via str_repeat
Trying to allocate a `zend_string` with a length only slighty smaller
than `SIZE_MAX` causes an integer overflow, so callers may need to
check that explicitly.  To make that easy in a portable way, we
introduce `ZSTR_MAX_LEN`.

Closes GH-7294.
2021-07-21 15:31:37 +02:00
Dmitry Stogov
a9991fbf28 Fixed Bug #80959 (infinite loop in building cfg during JIT compilation) 2021-07-21 14:32:44 +03:00
Dmitry Stogov
02acc5ad3b Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT) 2021-07-20 22:14:32 +03:00
Nikita Popov
051ff33660 Fix bug #81272: Fix func info for functions returning EMPTY_ARRAY
The empty array has refcount > 1, so we should indicate this in
func info. In most cases this renders the func info redundant,
so drop it entirely.
2021-07-20 14:40:17 +02:00
Christoph M. Becker
18abfcb306
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Fix #79908: json_encode encodes negative zero as int"
2021-07-20 00:28:27 +02:00
Christoph M. Becker
2d2c001ca5
Revert "Fix #79908: json_encode encodes negative zero as int"
This reverts commit 717f1ed5e4.
2021-07-20 00:25:50 +02:00
Christoph M. Becker
ef77d3c89f
Fix #81206: Multiple PHP processes crash with JIT enabled
We need to avoid resetting the JIT for all SAPIs, but we need to
initialize the JIT handlers even when only reattaching on Windows.

Closes GH-7208.
2021-07-19 23:45:37 +02:00
Dmitry Stogov
c0e4932816 Fixed bug #81249 (Intermittent property assignment failure with JIT enabled) 2021-07-19 12:11:09 +03:00
Dmitry Stogov
9cd437138e Fixed bug #81225 (Wrong result with pow operator with JIT enabled) 2021-07-19 10:39:52 +03:00
Christoph M. Becker
9fbcaa57aa
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78238: BCMath returns "-0"
2021-07-16 15:56:15 +02:00
Christoph M. Becker
bcb89c75ec
Fix #78238: BCMath returns "-0"
There is no negative zero in the decimal system, so we must suppress
the sign.

Closes GH-7250.
2021-07-16 15:54:24 +02:00
Nikita Popov
12a858ac95 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #81265: getimagesize returns 0 for 256px ICO images
2021-07-16 10:07:26 +02:00
George Dietrich
8f97f82e35 Fix bug #81265: getimagesize returns 0 for 256px ICO images
Set ICO height/width to 256 if 0.
2021-07-16 10:05:58 +02:00
Christoph M. Becker
bb4dbbc150
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80849: HTTP Status header truncation
2021-07-15 19:13:58 +02:00
Christoph M. Becker
a054ef2aad
Fix #80849: HTTP Status header truncation
While truncating the contents of a header is okay, we must never omit
the trailing CRLF.

Closes GH-7238.
2021-07-15 19:10:53 +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
Christoph M. Becker
c0a1ef3e32
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #72146: Integer overflow on substr_replace
2021-07-15 12:56:12 +02:00
Christoph M. Becker
33f8dfb15a
Fix #72146: Integer overflow on substr_replace
Adding two `zend_long`s may overflow, and casting `size_t` to
`zend_long` may truncate; we can avoid this here by enforcing unsigned
arithmetic.

Closes GH-7240.
2021-07-15 12:54:28 +02:00
Derick Rethans
f40dcedb48 Update NEWS for 7.4.22 2021-07-13 17:21:34 +01:00
Sara Golemon
7dc35ac8a7
Bump to 8.0.10 2021-07-13 14:10:35 +00:00
Christoph M. Becker
1ba190bdb3
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79908: json_encode encodes negative zero as int
2021-07-13 15:32:32 +02:00
Christoph M. Becker
717f1ed5e4
Fix #79908: json_encode encodes negative zero as int
Encoding a negative zero as `-0` is likely to loose the sign when
decoding (at least it does with `json_decode()`).  Therefore, we encode
it as if `JSON_PRESERVE_ZERO_FRACTION` was specified, i.e. as `-0.0`.

Closes GH-7234.
2021-07-13 15:31:07 +02:00
Christoph M. Becker
0c0ecf0470
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73226: --r[fcez] always return zero exit code
2021-07-12 23:12:19 +02:00
Christoph M. Becker
9db3eda2cb
Fix #73226: --r[fcez] always return zero exit code
This makes the behavior consistent with `--ri`, and is likely useful
for scripting.

Closes GH-7221.
2021-07-12 23:09:28 +02:00
Christoph M. Becker
5fb5a739e2
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81243: Too much memory is allocated for preg_replace()
2021-07-12 18:35:49 +02:00
Christoph M. Becker
a6b43086e6
Fix #81243: Too much memory is allocated for preg_replace()
Trimming a potentially over-allocated string appears to be reasonable,
so we drop the condition altogether.

We also re-allocate twice the size needed in the first place, and not
roughly tripple the size.

Closes GH-7231.
2021-07-12 18:33:55 +02:00
Christoph M. Becker
d776413f0b
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81223: flock() only locks first byte of file
2021-07-06 12:00:09 +02:00
Christoph M. Becker
520c00a5bf
Fix #81223: flock() only locks first byte of file
`flock()` should lock the whole file, like on other systems which use
mandatory locking.  We cannot use `0` like for `flck.l_len`, so we use
the largest number, what is valid according to the documentation:
<https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-lockfileex#remarks>.

Closes GH-7216.
2021-07-06 11:58:02 +02:00
Christoph M. Becker
8071bd2faf
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #74264: grapheme_strrpos() broken for negative offsets
2021-07-05 18:15:24 +02:00
Christoph M. Becker
28c9376306
Fix #74264: grapheme_strrpos() broken for negative offsets
We must not assume that `usearch_last()` gives the proper result for
negative offsets.  Instead we'd need to continue to search backwards
(`usearch_previous`) until we find a proper match.  However, apparently
searching backwards is broken, so we work around by searching forward
from the start of the string until we pass the `offset_pos`, and then
use the previous result.

Closes GH-7189.
2021-07-05 18:11:30 +02:00
Nikita Popov
4e66e6a73a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80173
2021-07-02 10:08:40 +02:00
Nikita Popov
bdc60fa7da Fixed bug #80173
The analysis in the bug report wasn't correct (at least not in
this case -- there may still be a more general problem here),
the issue was that write_property returned the original variable_ptr
rather than the zend_assign_to_variable() return value, which will
DEREF the variable before overwriting it.
2021-07-02 10:07:40 +02:00
Christoph M. Becker
5b0a46908c
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #52093: openssl_csr_sign truncates $serial
2021-07-01 15:43:52 +02:00
Christoph M. Becker
334387bb70
Fix #52093: openssl_csr_sign truncates $serial
We use `ASN1_INTEGER_set_int64()` if supported[1], to avoid the
truncation of the integer.

[1] <https://www.openssl.org/docs/man1.1.0/man3/ASN1_INTEGER_set_int64.html#HISTORY>

Closes GH-7209.
2021-07-01 15:42:02 +02:00
Nikita Popov
b976bc44f1 Fixed bug #81208
The number of populated positional arguments is argc. i may also
include named args and thus try to dtor uninitialized zvals.
2021-07-01 13:36:57 +02:00
Christoph M. Becker
70b0330e53
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
2021-06-30 16:15:50 +02:00
Christoph M. Becker
d7db5701a3
Fix #73630: Built-in Weberver - overwrite $_SERVER['request_uri']
The built-in Webserver's `on_path`, `on_query_string` and `on_url`
callbacks may be called multiple times from the parser; we must not
simply replace the old values, but need to concatenate the new values
instead.

This appears to be tricky for `on_path` due to the path normalization,
so we fail if the function is called again.

The built-in Webserver logs errors during request parsing to stderr,
but this is ignored by the php_cli_server framework, and apparently the
Webserver does not send a resonse at all in such cases (instead of an
4xx).  Thus we can only check that a request with an overly long path
fails.

Closes GH-7207.
2021-06-30 16:13:08 +02: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
53ea910d17
7.3.30 is next 2021-06-29 14:14:53 +02:00
Christoph M. Becker
f5cba2d491
[ci skip] Fix NEWS format 2021-06-29 10:28:35 +02:00
Christoph M. Becker
1bf2b04b26
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
2021-06-28 13:55:56 +02:00
Christoph M. Becker
1a01f7816c
Fix #68471: IntlDateFormatter fails for "GMT+00:00" timezone
GMT+00:00 is recognized by ICU, and is normalized to GMT.  There are no
issues when GMT+00:00 is passed to `IntlTimeZone::createTimeZone()`,
but passing it to IntlDateFormatter::__construct() causes a failure,
since there is an additional check regarding the validity.  While
checking the validity of the result of `TimeZone::createTimeZone()`[1]
is a good idea, comparing the IDs is overly restrictive.  Instead we
just check that the timezone is supported by ICU.

[1] <https://unicode-org.github.io/icu-docs/apidoc/dev/icu4c/classicu_1_1TimeZone.html#a35da0507b62754ffe5d8d59c19775cdb>

Closes GH-7190.
2021-06-28 13:54:22 +02:00
Stanislav Malyshev
c68a687566
Update NEWS 2021-06-20 22:20:38 -07:00
Anatol Belski
2b948720ab
NEWS: Add bug #81101 note
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2021-06-19 16:54:11 +02:00
Anatol Belski
4d8eb892b9
NEWS: Add bug #81101 note
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2021-06-19 16:51:13 +02:00
George Peter Banyard
f0fd5922ee
Fix bug #81159: Object to int warning when using an object as a string offset
Closes GH-7167
2021-06-18 18:07:22 +01:00
Joe Watkins
7bf930d014
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #81163 indirect vars in __sleep
2021-06-18 11:17:03 +02:00
Joe Watkins
bc59b046c6
Fix bug #81163 indirect vars in __sleep 2021-06-18 11:16:26 +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
Christoph M. Becker
13f3999a77
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #72809: Locale::lookup() wrong result with canonicalize option
2021-06-16 10:36:51 +02:00
Christoph M. Becker
0f1b17e378
Fix #72809: Locale::lookup() wrong result with canonicalize option
Canonicalization converts the locale to ICU format[1].  However, the
lookup described in RFC 4647, section 3.4, is about POSIX format.  To
make that lookup work for ICU format, we also need to cater to keyword
separators.

The results are somewhat unexpected, but apparently canonical lookup is
explicitly supposed to return canonical language tags[2].

[1] <https://unicode-org.github.io/icu/userguide/locale/#canonicalization>
[2] <https://github.com/php/php-src/blob/php-7.4.20/ext/intl/locale/locale_methods.c#L1504>

Closes GH-7151.
2021-06-16 10:33:59 +02:00
Derick Rethans
8370a084e4 Prepare for 7.4.22 2021-06-15 19:52:02 +01:00
Gabriel Caruso
b81c3b5b1c
Prepare for PHP 8.0.9 2021-06-15 09:19:13 +02:00
Nikita Popov
5dc31e0cb6 Fixed bug #80197
Use "libmagic/magic.h" rather than <magic.h> to make sure that we
use the bundled libmagic, even if there is a system libmagic on the
include path.
2021-06-14 10:59:13 +02:00
Christoph M. Becker
21f2ff79de
Fix #81120: PGO data for main PHP DLL are not used
We need to look for the right file.  To avoid total confusion, we also
rename the variables; however, the right solution would have been to
drop the version suffixes, since they don't help (major + minor maybe,
but not major only).
2021-06-10 22:57:09 +02:00
Nikita Popov
087773879f Fix bug #81119
The implementation for functions and operators is shared. However,
we should not be generating argument errors for operators.
2021-06-10 14:47:36 +02:00
Christoph M. Becker
902ec698eb
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81092: fflush before stream_filter_remove corrupts stream
2021-06-08 15:38:57 +02:00
Christoph M. Becker
a1738d8bd1
Fix #81092: fflush before stream_filter_remove corrupts stream
When doing a non finishing flush, BZ2_bzCompress() returns BZ_FLUSH_OK
(not BZ_FINISH_OK) what requires us to do further flushes right away.

We also refactor the while-loop as do-loop.

Closes GH-7113.
2021-06-08 15:36:37 +02:00
Joe Watkins
1143155fcb
fix bug #72998
the function fn_complete in libedit null checks matches[2]
2021-06-03 10:33:10 +02:00
Nikita Popov
324ad2f42c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81070

This is a non-trivial merge. To avoid an ABI break, a new
zend_set_memory_limit_ex() function is added.
2021-05-31 15:24:00 +02:00
Peter van Dommelen
1b3b5c94e5 Fixed bug #81070
When the memory limit is reduced using an `ini_set("memory_limit", ..)`
below the currently allocated memory, the out-of-memory check overflowed.
Instead of implementing additional checks during allocation,
`zend_set_memory_limit()` now validates the new memory limit. When
below the current memory usage the ini_set call will fail and throw
a warning.

This is part of GH-7040.
2021-05-31 15:18:58 +02:00
Christoph M. Becker
108105b2c6
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:36:57 +02:00
Christoph M. Becker
7fd48264de
Fix #76694: native Windows cert verification uses CN as sever name
This is not guaranteed to work, since the actual server name may only
be given as SAN.  Since we're doing the peer verification later anyway
(using the respective context options as appropriate), there is no need
to even supply a server name when verifying against the Windows cert
store.

Closes GH-7060.
2021-05-31 14:35:17 +02:00
Nikita Popov
ee74f2e57f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81090
2021-05-31 12:33:59 +02:00
Nikita Popov
82f6f6da67 Fixed bug #81090
For concatenation, the in-place variant can be much more efficient,
because it will reallocate the string in-place. Special-case the
typed property compound assignment code for the case where we
concatenate to a string, in which case we know that the result
will also be a string, and we don't need the type check anyway.
2021-05-31 12:31:56 +02:00
Máté Kocsis
a0af84bebd
Fixed bug #81088 error in regression test for oci_fetch_object() and oci_fetch_array()
Closes GH-7072
2021-05-28 17:56:51 +02:00
Nikita Popov
635303aec5 Fixed bug #80761
When row data split across multiple packets, allocate a temporary
buffer that can be reallocated, and only copy into the row buffer
pool arena once we know the final size. This avoids quadratic
memory usage for very large results.

(cherry picked from commit 1fc4c89214)
2021-05-27 16:00:03 +02:00
Dmitry Stogov
ac65f6af6e Fixed bug #81051 (Broken property type handling after incrementing reference) 2021-05-27 15:22:34 +03:00
Christoph M. Becker
a5601b2ab5
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76359: open_basedir bypass through adding ".."
2021-05-25 13:46:38 +02:00
Christoph M. Becker
ee9e07541f
Fix #76359: open_basedir bypass through adding ".."
We explicitly forbid adding paths with a leading `..` to `open_basedir`
at runtime.

Closes GH-7024.
2021-05-25 13:44:53 +02:00
Nikita Popov
0fb371440d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
2021-05-25 11:40:57 +02:00
Dimitry Andric
99a208566a Fix bug #81068: Fix possible use-after-free in realpath_cache_clean()
If ZTS is enabled, this can cause cwd_globals_ctor() to be called
multiple times, each with a freshly allocated virtual_cwd_globals
instance. At shutdown time however, cwd_globals_dtor() will call
realpath_cache_clean(), which then possibly cleans up the same
realpath_cache instance more than once. Using AddressSanitzer, this
shows up as a heap use-after-free.

To avoid this, add a helper function to do the actual work on one
instance of a realpath_cache, and call it both from cwd_globals_dtor()
and realpath_cache_clean(). The former uses the virtual_cwd_globals
parameter passed in via the destructor, the latter uses the CWDG()
macro.
2021-05-25 11:40:28 +02:00
Joe Watkins
213063f6ca
Fix #81076 Invalid implicit binds cause incorrect count in static vars of closure debug info 2021-05-25 11:26:38 +02:00
Joe Watkins
cfd4d3df0b
Fix #77627 method_exists on Closure::__invoke 2021-05-25 11:22:05 +02:00
Dmitry Stogov
6e2d47e071 Fixed bug #80968 (JIT segfault with return from required file) 2021-05-20 16:45:24 +03:00
Sara Golemon
64918fee97
Prep for 8.0.8 2021-05-19 19:18:56 +00:00
Christoph M. Becker
5dfdd694e7
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81048: phpinfo(INFO_VARIABLES) "Array to string conversion"
2021-05-19 14:09:21 +02:00
Christoph M. Becker
36b9bdeeec
Fix #81048: phpinfo(INFO_VARIABLES) "Array to string conversion"
Now that we properly dereference references of the superglobals. we
also need to dereference contained references to avoid to string
conversion.

Closes GH-7014.
2021-05-19 14:07:15 +02:00
Derick Rethans
3938bfb564 The PHP 7.4 branch is now for 7.4.21 2021-05-18 13:44:01 +01:00
Christoph M. Becker
6c3896b1e9
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  [ci skip] Removed incorrect news entry
2021-05-18 12:36:21 +02:00
Graham Campbell
66c3a174f5
[ci skip] Removed incorrect news entry
Closes GH-7007.
2021-05-18 12:34:46 +02:00
Nikita Popov
0bff67c0ab Fixed bug #81019
Before the zval -> zend_object migration, this code used macros
like FORMATTER_METHOD_FETCH_OBJECT_NO_CHECK, which internally
clear the error. Now that they are no longer used, we need to
manually clear the error.
2021-05-17 16:33:35 +02:00
Nikita Popov
c446d68f7c Fixed bug #81046
Literal compaction was incorrectly assuming that literals with
the same base literal and the same number of related literals
would be equal. Maybe that was the case historically, but at
least it isn't true in PHP 8, where FETCH_CONSTANT and INIT_METHOD
have distinct literals at the second position.

Fix this by making the cache key a concatenation of all literals,
rather than just the base literal. We still distinguish the number
of related literals based on a bias added to the string hash.
2021-05-17 15:46:49 +02:00
Kamil Tekiela
5c164a2223
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix NEWS
2021-05-14 12:34:46 +01:00
Kamil Tekiela
ead72aabfb
Fix NEWS 2021-05-14 12:33:32 +01:00
Kamil Tekiela
574b551567
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81037 PDO discards error message text from prepared statement
2021-05-14 11:59:36 +01:00
Kamil Tekiela
6afbb74194
Fixed bug #81037 PDO discards error message text from prepared statement 2021-05-14 11:54:49 +01:00
Christoph M. Becker
c455f49a6a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81032: GD install is affected by external libgd installation
2021-05-14 12:26:40 +02:00
Flavio Heleno
28e7addb9d
Fix #81032: GD install is affected by external libgd installation
This PR replaces the bundled libgd includes from #include <foo.h> with
#include "foo.h" for gd-related headers to avoid including headers that
may be available in system directories instead of the expected local
headers.

Closes GH-6975.
2021-05-14 12:24:45 +02:00
Christoph M. Becker
63c558bcbb
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #44643: bound parameters ignore explicit type definitions
2021-05-12 13:47:01 +02:00
Christoph M. Becker
23a3bbb468
Fix #44643: bound parameters ignore explicit type definitions
If `SQLDescribeParam()` fails for a parameter, we must not assume
`SQL_LONGVARCHAR` for any param which is not `PDO_PARAM_LOB`.  At least
mapping `PDO_PARAM_INT` to `SQL_INTEGER` should be safe, and not
introduce a BC break.

Closes GH-6973.
2021-05-12 13:30:51 +02:00
Joe Watkins
6ccbaa12e0
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  php-fpm: fix Solaris port events.mechanism
2021-05-11 11:07:47 +02:00
Petr Sumbera
04078a597c
php-fpm: fix Solaris port events.mechanism
Bug #65800
Fix by: rainer.jung@kippdata.de
2021-05-11 11:01:38 +02:00
Nikita Popov
090627048c Revert "Remove no longer used "log_errors_max_len" ini directive (#6838)"
This reverts commit d2d227e547.

This is an ABI break.
2021-05-08 20:54:53 +02:00
Ben Ramsey
c2b5284734
Add entries for log_errors_max_len INI directive removal 2021-05-08 13:35:35 -05:00
Christoph M. Becker
ab3052ab26
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80863: ZipArchive::extractTo() ignores references
2021-05-07 19:21:58 +02:00
Christoph M. Becker
57918b1a1b
Fix #80863: ZipArchive::extractTo() ignores references
We need to cater to references, when traversing the files to extract.
While we're at it, we move the `zval_file` declaration into a narrower
scope.

Closes GH-6959.
2021-05-07 19:15:29 +02:00
Nikita Popov
dd3e56ba24 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81015
2021-05-06 10:46:30 +02:00
Nikita Popov
178bbe3478 Fixed bug #81015
Make sure that the previous opline is part of the same block,
otherwise it may be non-dominating.

The test case does not fail on PHP-7.4, but I think the general
problem can appear on 7.4 as well, so I'm applying the patch to
that branch.
2021-05-06 10:46:00 +02:00
Nikita Popov
bf9dc53435 Fixed bug #81007
Backport a change from the master branch. We usually test 32-bit
using -m32 from an x86-64 host, probably nobody tried using an
actual 32-bit host.
2021-05-05 16:53:43 +02:00
Sara Golemon
f020d537b0
Reset for 8.0.7 2021-05-04 17:17:20 +00:00
Christoph M. Becker
d1c0cbdcb1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81011: mb_convert_encoding removes references from arrays
2021-05-04 18:39:39 +02:00
Christoph M. Becker
0cafd53d18
Fix #81011: mb_convert_encoding removes references from arrays
We need to dereference references.

Closes GH-6938.
2021-05-04 18:37:40 +02:00
Derick Rethans
0328ff49cc Reset PHP-7.4 for 7.4.20 2021-05-04 12:18:27 +01:00
Christoph M. Becker
c2a06f5d9a
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79100: Wrong FTP error messages
2021-05-03 15:24:17 +02:00
Christoph M. Becker
42c72ef463
Fix #79100: Wrong FTP error messages
First we need to properly clear the `inbuf`, what is an amendment to
commit d2881adcbc[1].

Then we need to report `php_pollfd_for_ms()` failures right away; just
setting `errno` does not really help, since at least in some cases it
would have been overwritten before we actually could check it.  We use
`php_socket_strerror()` to get a proper error message, and define
`ETIMEDOUT` to the proper value on Windows; otherwise we catch the
definition in errno.h, which is not compatible with WinSock.  The
proper solution for this issue would likely be to include something
like ext/sockets/windows_common.h.

Finally, we ensure that we only report warnings using `inbuf`, if it is
not empty.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=d2881adcbc9be60de7e7d45a3316b0e11b7eb1e8>.

Closes GH-6718.
2021-05-03 15:19:57 +02:00
Christoph M. Becker
645815c5b7
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73246: XMLReader: encoding length not checked
2021-05-03 12:29:24 +02:00
Christoph M. Becker
272df442f5
Fix #73246: XMLReader: encoding length not checked
libxml2 expects the passed encoding to be NUL terminated, so we reject
strings with NUL bytes right away.

Closes GH-6899.
2021-05-03 12:26:37 +02:00
Matteo Beccati
7bc9df4af2
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR"
2021-04-29 12:05:49 +02:00
Matteo Beccati
b8e49fe872
Revert "Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR"
This reverts commit 340a06778c.
2021-04-29 11:59:16 +02:00
Christoph M. Becker
4c80e439a8
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
2021-04-27 17:12:01 +02:00
Christoph M. Becker
7f83976200
Fix #80460: ODBC doesn't account for SQL_NO_TOTAL indicator
The `StrLen_or_IndPtr` parameter usually may be `SQL_NO_TOTAL`; we need
to cater to that possibility to avoid working with negative string
lengths and other issues.  A noteable exemption are calls to
`SQLGetData()` which return `SQL_SUCCESS`; in that case `SQL_NO_TOTAL`
can not occur.

Closes GH-6809.
2021-04-27 17:09:36 +02:00
Christoph M. Becker
98c8ad9218
7.3.29 is next 2021-04-27 16:55:20 +02:00
Christoph M. Becker
096f148c61
Fix ./makedist wrt. to GH move
We can no longer export from git.php.net, and apparently exporting from
Github is not supported.  We apply a quick fix to export from the local
clone by default, still leaving an option to export from some other
repo.  This is, unfortunately, a minor BC break in a security release.

Co-authored-by: Remi Collet <remi@php.net>

Closes GH-6919.
2021-04-27 15:48:58 +02:00
Christoph M. Becker
3e518e069d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Add missing NEWS entry for #80710
2021-04-27 13:43:12 +02:00
Christoph M. Becker
12e15be921
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Add missing NEWS entry for #80710
2021-04-27 13:41:20 +02:00
Christoph M. Becker
60a68a45c3
Add missing NEWS entry for #80710 2021-04-27 13:38:39 +02:00
Christoph M. Becker
c0ae3a7fb7
Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 15:07:08 +02:00
Christoph M. Becker
bc6fc61c04
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix typo in NEWS
2021-04-26 15:03:10 +02:00
Christoph M. Becker
7f9183ce20
Fix typo in NEWS 2021-04-26 15:02:13 +02:00
Christoph M. Becker
33d49551d1
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80901: Info leak in ftp extension
2021-04-26 14:45:55 +02:00
Christoph M. Becker
09696eee9d
Fix #80901: Info leak in ftp extension
We ensure that inbuf is NUL terminated on `ftp_readline()` failure.

Closes GH-6894.
2021-04-26 14:23:04 +02:00
George Peter Banyard
97f8ca52fa
Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6909
2021-04-26 13:22:12 +01:00
George Peter Banyard
418fcd22e8
Fix Bug #80972: Memory exhaustion on invalid string offset
Closes GH-6890
2021-04-26 13:21:40 +01:00
Christoph M. Becker
23a192d12d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #67792: HTTP Authorization schemes are treated as case-sensitive
2021-04-23 15:57:11 +02:00
Christoph M. Becker
39ddf6b89c
Fix #67792: HTTP Authorization schemes are treated as case-sensitive
We use `zend_binary_strncasecmp()` to avoid any locale issues, and
refactor.  We also add a test case for Digest authentication.

Closes GH-6900.
2021-04-23 15:54:17 +02:00
Christoph M. Becker
3c6480552d
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
2021-04-20 18:30:25 +02:00
Christoph M. Becker
1fcea24efb
Fix php_pgsql_fd_cast() wrt. php_stream_can_cast()
`php_stream_can_cast()` forwards to `_php_stream_cast()` with `ret` set
to `NULL`.  `php_pgsql_fd_cast()` needs to cater to that, because
otherwise the stream would report that it is not castable.

This *might* fix https://bugs.php.net/73903.

Closes GH-6888.
2021-04-20 18:29:12 +02:00
Christoph M. Becker
cb262cd974
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80960: opendir() warning wrong info when failed on Windows
2021-04-19 16:17:01 +02:00
Christoph M. Becker
ea3c992bff
Fix #80960: opendir() warning wrong info when failed on Windows
Firstly, we must not forget to set appropriate error codes for "manual"
checks in `virtual_file_ex()`.

Secondly, we must not call `php_error_docref2()` for warnings regarding
unary functions; thus, we introduce `php_win32_docref1_from_error()`.

Closes GH-6872.
2021-04-19 16:12:22 +02:00
twosee
c0b1bdcdc3
Fixed bug #80929
The function name should be kept if Closure was created from the function which is marked as ZEND_ACC_CALL_VIA_TRAMPOLINE, because it is not a one-time thing and it may be called multiple times.

Closes GH-6867.
2021-04-16 09:48:36 +08:00
twosee
7c6cf09463
Fixed bug #80900
SCCP optimization marks the wrong target feasible when the constant is of the incorrect type.

Closes GH-6861.
2021-04-14 00:07:32 +08:00
Christoph M. Becker
80f921d7e0
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80933: SplFileObject::DROP_NEW_LINE is broken for NUL and CR
2021-04-13 16:49:57 +02:00
Christoph M. Becker
976e71a2fa
Fix #80933: SplFileObject::DROP_NEW_LINE is broken for NUL and CR
`buf` may contain NUL bytes, so we must not use `strcspn()` but rather
a binary safe variant.  However, we also must not detect a stray CR as
line ending, and since we only need to check line endings at the end
of the buffer, we can nicely optimize.

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

Closes GH-6836.
2021-04-13 16:49:06 +02:00
Derick Rethans
f99926f554 Put back inadvertedly removed NEWS entries 2021-04-13 11:48:50 +01:00
Gabriel Caruso
79872ac9c2
8.0.6 is the next version 2021-04-13 12:41:21 +02:00
Derick Rethans
8e48895f48 Prepare for 7.4.19 2021-04-13 11:34:40 +01:00
Derick Rethans
d4f7e8cedc Prepare NEWS for 7.4.18RC1 2021-04-13 10:00:45 +01:00
Nikita Popov
a1fdfa700b Fixed bug #80950
Function info for curl_exec() incorrect specified that the
function cannot return true. This is already fixed in PHP 8,
as the func info entry was removed there.
2021-04-12 16:05:37 +02:00
Christoph M. Becker
d74c61c133
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79812: Potential integer overflow in pcntl_exec()
2021-04-12 12:15:07 +02:00
Christoph M. Becker
0a36d417e8
Fix #79812: Potential integer overflow in pcntl_exec()
We use the proper type, and make sure that no overflow can occur by
using `safe_emalloc()` (we can assume that neither string length is
`SIZE_MAX`).

Closes GH-6845.
2021-04-12 12:12:40 +02:00
Rowan Tommins
4e98e65d53 Remove the "getdir" function which was introduced accidentally
The actual name of this function is dir(), but ever since it was
introduced in PHP 3, its internal name was "getdir", leading to it
being mistaken for an alias. This went unnoticed until the switch
to stubs for generating arginfo, at which point getdir() became a
real but undocumented function.

Fixes bug #80914.

Closes GH-6855.
2021-04-12 11:13:57 +02:00
Matteo Beccati
4f236635e7
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR
2021-04-12 08:05:41 +02:00
Matteo Beccati
340a06778c
Fix #80892: PDO::PARAM_INT is treated the same as PDO::PARAM_STR 2021-04-12 08:03:07 +02:00
Christoph M. Becker
de9734a5bb
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80880: SSL_read on shutdown, ftp/proc_open
2021-04-06 14:07:25 +02:00
Christoph M. Becker
9688071679
Fix #80880: SSL_read on shutdown, ftp/proc_open
When `SSL_read()` after `SSL_shutdown()` fails with `SSL_ERROR_SYSCALL`,
we should not warn about this, because it is likely caused by the peer
having closed the connection without having sent a close_notify
shutdown alert.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6803.
2021-04-06 14:03:19 +02:00
Dmitry Stogov
e0996decc3 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
2021-03-31 13:11:11 +03:00
Dmitry Stogov
39d8fc1edc Changed PowerPC CPU registers used by Zend VM to work around GCC bug.
Old registers (r28/r29) might be clobbered by _restgpr routine used for return from C function compiled with -Os.
2021-03-31 13:10:21 +03:00
Christoph M. Becker
443478109b
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle reference zvals when outputting superglobals in phpinfo()

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:52:38 +02:00
Rowan Tommins
206fd35a98
Handle reference zvals when outputting superglobals in phpinfo()
Fixes <https://bugs.php.net/80915>.

Closes GH-80915.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-30 13:49:22 +02:00
Christoph M. Becker
dd227f61df
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #69668: SOAP special XML characters in namespace URIs not encoded

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:19:39 +02:00
Christoph M. Becker
75cb678206
Fix #69668: SOAP special XML characters in namespace URIs not encoded
`xmlNewNs()` does not XML encode the passed `href`, so we need to do
that manually.

Closes GH-6804.

Signed-off-by: Christoph M. Becker <cmbecker69@gmx.de>
2021-03-29 14:17:55 +02:00
Christoph M. Becker
5832be768c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
2021-03-24 11:52:54 +01:00
Christoph M. Becker
498eb8e052 Fix #73533: Invalid memory access in php_libxml_xmlCheckUTF8
A string passed to `php_libxml_xmlCheckUTF8()` may be longer than
1<<31-1 bytes, so we're better using a `size_t`.

Closes GH-6802.
2021-03-24 11:50:50 +01:00
Jakub Zelenka
713b82131b Merge branch 'PHP-7.4' into PHP-8.0 2021-03-21 19:00:38 +00:00
Jakub Zelenka
538f95b1b7 Fix NEWS entry position for the latest FPM fix 2021-03-21 18:58:57 +00:00
Jakub Zelenka
c483b59124 Fix bug #80024: Duplication of info about inherited socket after pool removing 2021-03-21 18:52:07 +00:00
Christoph M. Becker
2a1ed81ffc Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80889: Cannot set save handler when save_handler is invalid
2021-03-19 17:03:54 +01:00
Christoph M. Becker
06bfada99b Fix #80889: Cannot set save handler when save_handler is invalid
There is no need to require a (valid) save_handler to be set, when a
user handler is supposed to be set.  We just have to make sure, that
no user handler is already set in this case.

Closes GH-6788.
2021-03-19 16:59:54 +01:00
Christoph M. Becker
97cfdcd73b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
2021-03-18 15:18:53 +01:00
Christoph M. Becker
bccca0b53a Fix #80783: PDO ODBC truncates BLOB records at every 256th byte
It is not guaranteed, that the driver inserts only a single NUL byte at
the end of the buffer.  Apparently, there is no way to find out the
actual data length in the buffer after calling `SQLGetData()`, so we
adjust after the next `SQLGetData()` call.

We also prevent PDO::ODBC_ATTR_ASSUME_UTF8 from fetching garbage, by
fetching all chunks with the same C type.

Closes GH-6716.
2021-03-18 15:13:27 +01:00
Dmitry Stogov
7e494d9225 Fixed bug #80861 (erronous array key overflow in 2D array with JIT) 2021-03-17 22:59:59 +03:00
Dmitry Stogov
faf1567212 Fixed bug #80839 (PHP problem with JIT) 2021-03-17 16:55:09 +03:00
Christoph M. Becker
fddd0ac552 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #66783: UAF when appending DOMDocument to element
2021-03-17 12:40:03 +01:00
Christoph M. Becker
a08847ab39 Fix #66783: UAF when appending DOMDocument to element
According to the DOM standard, elements may only contain element, text,
processing instruction and comment nodes[1].  It is also specified that
a HierarchyRequestError should be thrown if a document is to be
inserted[2].  We follow that standard, and prevent the use-after-free
this way.

[1] <https://dom.spec.whatwg.org/#node-trees>
[2] <https://dom.spec.whatwg.org/#mutation-algorithms>

Closes GH-6765.
2021-03-17 12:37:18 +01:00
Christoph M. Becker
c7fadd2328 8.0.5 is next
We also move the NEWS entry for bug 80847 to the proper version.
2021-03-17 12:14:26 +01:00
Dmitry Stogov
38ebb55c7c Fixed bug #80847 (CData structs with fields of type struct can't be passed as C function argument) 2021-03-17 09:55:20 +03:00
Derick Rethans
5e4ee3d0bd NEWS for 7.4.18 2021-03-16 09:40:05 +00:00
Derick Rethans
eb1d1fe373 Prepare for 7.4.17RC1 2021-03-16 09:33:33 +00:00
Christoph M. Becker
eae69fcf71 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
2021-03-15 18:39:26 +01:00
Christoph M. Becker
f448b0e6dd Fix #80817: dba_popen() may cause segfault during RSHUTDOWN
We need to close persistent streams with the proper flag.
2021-03-15 18:37:44 +01:00
Nikita Popov
50254de0a2 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80866
2021-03-15 14:48:02 +01:00
Dharman
282355efd5 Fix bug #80866
Closes GH-6774.
2021-03-15 14:47:45 +01:00
Nikita Popov
6493b516f9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug #80837
2021-03-15 14:38:49 +01:00
Dharman
c93b461ad7 Fix bug #80837
The error needs to be reported on the statement, not the connection.
2021-03-15 14:38:09 +01:00
Dmitry Stogov
3b377b51a2 Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage) 2021-03-10 16:03:47 +03:00
Christoph M. Becker
7931956805 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #51903: simplexml_load_file() doesn't use HTTP headers
2021-03-08 15:15:59 +01:00
Christoph M. Becker
f901bec494 Fix #51903: simplexml_load_file() doesn't use HTTP headers
The `encoding` attribute of the XML declaration is optional; it is good
practice to use external encoding information where available if it is
missing.  Thus, we check for `charset` info of `Content-Type` headers,
and see whether the encoding is supported.

We cater to trailing parameters and quoted-strings, but not to escaped
backslashes and quotes in quoted-strings, since no known character
encoding contains these anyway.

Co-authored-by: Michael Wallner <mike@php.net>

Closes GH-6747.
2021-03-08 15:07:01 +01:00
Christoph M. Becker
3880b8785b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
2021-03-08 14:51:45 +01:00
manuel
5787f91c55 Fix #80838: HTTP wrapper waits for HTTP 1 response after HTTP 101
Don't wait for further responses after a HTTP 101 (Switching Protocols) response

Closes GH-6730.
2021-03-08 14:36:31 +01:00
Christoph M. Becker
4f478af16d Fix #80825: ZipArchive::isCompressionMethodSupported does not exist
`HAVE_METHOD_SUPPORTED` should have been defined after we updated to
libzip 1.7.1 months ago.
2021-03-03 22:56:42 +01:00
Christoph M. Becker
90b24401d6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78719: http wrapper silently ignores long Location headers
2021-03-03 10:47:51 +01:00
Christoph M. Becker
51e2015af3 Fix #78719: http wrapper silently ignores long Location headers
When opening HTTP streams, and reading the headers, we currently
discard header lines longer than `HTTP_HEADER_BLOCK_SIZE` (1024 bytes).
While this is not generally forbidden by RFC 7230, section 3.2.5, it
is not generally allowed either, since that may change the "message
framing or response semantics".

We thus fix this by allowing arbitrarily long header lines.

Closes GH-6720.
2021-03-03 10:45:25 +01:00
Nikita Popov
75a4f484f0 Fixed bug #80811
When filling in defaults for skipped params, make sure that
reference parameters get the expected reference wrapper.
2021-03-01 16:30:01 +01:00
Nikita Popov
e857936518 Fixed bug #80805
Handle missing result_var in binary_op_result_type.

(cherry picked from commit 8446e28275)
2021-03-01 15:13:15 +01:00
George Peter Banyard
1ee6aad248 Fix Bug #80800 imap_open() fails when the flags parameter includes CL_EXPUNGE
This also affected imap_reopen().
Add a supplementary test that the CL_EXPUNGE flag does have
the intended effect.

Closes GH-6732
2021-02-27 13:12:22 +00:00
Felipe Pena
78b0a85de6 Update NEWS 2021-02-24 18:40:32 +00:00
Dmitry Stogov
b7fa5268e4 Fixed bug #80782 (DASM_S_RANGE_VREG on PHP_INT_MIN-1) 2021-02-24 12:20:20 +03:00
Nikita Popov
79cf2c56d3 Fixed bug #80786
Don't use r0 as temporary register in math_double_long if it is
already used for a memory result.

This was already done in one branch, but not the other.
2021-02-23 10:22:00 +01:00
Christoph M. Becker
b418fe266d Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #75776: Flushing streams with compression filter is broken
2021-02-22 15:32:17 +01:00
Christoph M. Becker
963e50c8c4 Fix #75776: Flushing streams with compression filter is broken
First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between.  In that case, the compression is never finalized.  We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached.  This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=20e75329f2adb11dd231852c061926d0e4080929>

Closes GH-6703.
2021-02-22 15:28:46 +01:00
Christoph M. Becker
1d2bbce532 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
2021-02-22 14:34:21 +01:00
Christoph M. Becker
073b6ea818 Fix #80771: phpinfo(INFO_CREDITS) displays nothing in CLI
There is no good reason not to show the credits in text based SAPIs,
except for brevity.  Thus, we suppress the credits from `php -i`.

Closes GH-6710.
2021-02-22 14:31:51 +01:00
Christoph M. Becker
6dcd640f35 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80774: session_name() problem with backslash
2021-02-22 12:35:23 +01:00
Christoph M. Becker
d7c98ca1ac Fix #80774: session_name() problem with backslash
Since we do no longer URL decode cookie names[1], we must not URL
encode the session name.  We need to prevent broken Set-Cookie headers,
by rejecting names which contain invalid characters.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=6559fe912661ca5ce5f0eeeb591d928451428ed0>

Closes GH-6711.
2021-02-22 12:32:56 +01:00
Nikita Popov
6dd85f83f7 Fixed bug #80781
zend_find_array_dim_slow() may throw, make sure to handle this.
This backports the code we already use for this on PHP-8.0,
and also backports an exception check that makes this easier to
catch.
2021-02-22 09:36:43 +01:00
Christoph M. Becker
553a0c52b1 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80763: msgfmt_format() does not accept DateTime references
2021-02-17 17:30:47 +01:00
Christoph M. Becker
84b6152842 Fix #80763: msgfmt_format() does not accept DateTime references
`intl_zval_to_millis()` needs to cater to references.

Closes GH-6707.
2021-02-17 17:26:48 +01:00
Dmitry Stogov
7f68a7afe6 Fixed bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts) 2021-02-17 11:51:13 +03:00
Dmitry Stogov
fad87a24da Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true) 2021-02-16 20:02:12 +03:00
Nikita Popov
edb9229b8b Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Handle incomplete result set metadata more gracefully
2021-02-16 15:34:47 +01:00
Nikita Popov
9552cf6b84 Handle incomplete result set metadata more gracefully
Rather than segfaulting because sname is missing lateron, report
a FAIL here. As this indicates a server bug, the errors is reported
as an out of band warning, rather than a client error.

This fixes the PHP side of bug #80713.
2021-02-16 15:34:14 +01:00
Nikita Popov
cb9785add1 Fixed bug #80723
This fixes the issue just for the Socket class. Presumably we'll
want to do the same for other "resource" objects.
2021-02-16 12:33:50 +01:00
Derick Rethans
2d858fbfb1 Fixed dates 2021-02-16 11:31:34 +00:00
Derick Rethans
6d3d9104e6 PHP-7.4 is now 7.4.17-dev 2021-02-16 11:26:47 +00:00
Nikita Popov
f43097a2d7 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80747
2021-02-15 15:34:21 +01:00
Nikita Popov
64b1085464 Fixed bug #80747
If RSA key generation fails, actually report that failure.
2021-02-15 15:34:01 +01:00
Nikita Popov
8b9dd0a301 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #78680: mysqlnd pam plugin missing terminating null
2021-02-15 11:32:54 +01:00
Daniel Black
3646604203 Fix #78680: mysqlnd pam plugin missing terminating null
The PAM service requires the terminating null to be part
of the communication.

Tested with MariaDB-10.4(pam) and Percona Server 5.7.32(auth_pam_compat).

Also changed MySQL Enterprise test to the server side plugin, authentication_pam
as opposed to the client plugin mysql_clear_password.

Add additional check for pamtest user and pam service file as
all are required for the test.

More importantly, test result should actually succeed.

Thanks Geoff Montee for bug report.

Closes GH-78680.
2021-02-15 11:32:07 +01:00
Benjamin Eberlei
6ec25f386f Fixed bug #80600 2021-02-12 17:16:48 +01:00
Nikita Popov
5199686873 Fixed bug #80718 2021-02-11 16:49:39 +01:00