Commit Graph

12548 Commits

Author SHA1 Message Date
Dmitry Stogov
65120cfc09 Fixed bug #79412 (Opcache chokes and uses 100% CPU on specific script). 2020-03-25 17:31:06 +03:00
Nikita Popov
2b3b7f5cd9 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
2020-03-25 10:51:23 +01:00
Christian Schneider
c0840fec9c Fix bug #79410 (system() swallows last chunk if it is exactly 4095 bytes without newline)
Closes GH-5292.
2020-03-25 10:50:35 +01:00
Christoph M. Becker
a7bbfc95eb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79200: Some iconv functions cut Windows-1258
2020-03-23 14:13:42 +01:00
Christoph M. Becker
32a2644305 Fix #79200: Some iconv functions cut Windows-1258
To cater to potentially state-dependent encodings, we have to reset the
conversion descriptor into its initial shift state to properly finish
the conversion.  Furthermore, state-dependent encodings may not show
progress when comparing `in_left` before and after the conversion; we
rather have to see whether `out_left` has decreased.  Also we have to
cater to the fact that the final potentially state resetting call does
not signal failure, but we still have to break respective loops
afterwards.
2020-03-23 14:12:37 +01:00
Christoph M. Becker
4576da0aa7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79393: Null coalescing operator failing with SplFixedArray
2020-03-23 13:31:25 +01:00
Christoph M. Becker
47c745555c Fix #79393: Null coalescing operator failing with SplFixedArray
We favor the KISS principle over optimization[1] – SPL is already
special enough.

[1] <352f3d4476 (r112498098)>ff
2020-03-23 13:29:25 +01:00
Remi Collet
6c0f9c3fc6 NEWS 2020-03-20 11:17:29 +01:00
Remi Collet
51c57a9c67 NEWS 2020-03-20 11:16:08 +01:00
Christoph M. Becker
1d9e716a47 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79396: DateTime hour incorrect during DST jump forward
2020-03-19 08:51:55 +01:00
Nate Brunette
d70058a139 Fix #79396: DateTime hour incorrect during DST jump forward
When you attempt to set the time to a non-existent time occuring during
a DST jump forward, the hour does not move forward correctly.
2020-03-19 08:50:34 +01:00
Christoph M. Becker
1e63900cc0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix NEWS
2020-03-17 11:12:57 +01:00
Christoph M. Becker
9b8aa105ed Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix NEWS
2020-03-17 11:09:55 +01:00
Christoph M. Becker
6a4fff4682 Fix NEWS 2020-03-17 11:06:45 +01:00
Stanislav Malyshev
fc39bb9da9 [ci skip] Update NEWS 2020-03-16 22:40:48 -07:00
Stanislav Malyshev
e71fa03107 [ci skip] Update NEWS 2020-03-16 22:40:00 -07:00
Stanislav Malyshev
c8d21d7728 [ci skip] Update NEWS 2020-03-15 19:38:31 -07:00
Christoph M. Becker
ddc3f3d595 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79199: curl_copy_handle() memory leak
2020-03-12 11:27:45 +01:00
Christoph M. Becker
2b5fc8e325 Fix #79199: curl_copy_handle() memory leak
`curl_copy_handle()` already registers a new resource, so we must not
increase the refcount of the original resource.
2020-03-12 11:23:53 +01:00
Christoph M. Becker
2b56735ea0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #61597: SXE properties may lack attributes and content
2020-03-12 10:56:13 +01:00
Christoph M. Becker
7c081db885 Fix #61597: SXE properties may lack attributes and content
We must not treat a node as string if it has attributes, unless it is
an entity declaration which is always treated as string by simplexml.
2020-03-12 10:52:28 +01:00
Christoph M. Becker
8657f03084 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78210: Invalid pointer address
2020-03-11 11:31:26 +01:00
Christoph M. Becker
53797c206a Fix #78210: Invalid pointer address
This is actually about three distinct issues:

* If an empty string is passed as $address to `stream_socket_sendto()`,
  the `sa` is not initialized, so we must not pass it as `addr` to
  `php_stream_xport_sendto()`.

* On POSIX, `recvfrom()` truncates messages which are too long to fit
  into the specified buffer (unless `MSG_PEEK` is given), discards the
  excessive bytes, and returns the buffer length.  On Windows, the same
  happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
  `WSAEMSGSIZE`.  We have to catch this for best POSIX compatibility.

* In `php_network_parse_network_address_with_port()`, we have to zero
  `in6` (not only its alias `sa`) to properly support IPv6.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-11 11:30:15 +01:00
Christoph M. Becker
a72b261db5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79364: When copy empty array, next key is unspecified
2020-03-11 08:55:28 +01:00
Christoph M. Becker
2462f2dab1 Fix #79364: When copy empty array, next key is unspecified
We must not forget to keep the `nNextFreeElement` when duplicating
empty arrays.
2020-03-11 08:54:05 +01:00
Nikita Popov
760faa12b2 Fixed bug #79357
Peculiarly, for once the cause was not SOAPs "interesting" error
handling, but a bug in the call trampoline for internal functions...
2020-03-09 15:01:31 +01:00
Christoph M. Becker
b761997de3 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #75673: SplStack::unserialize() behavior
2020-03-06 09:11:10 +01:00
Christoph M. Becker
b84277297a Fix #75673: SplStack::unserialize() behavior
Even though `SplStack::unserialize()` is not supposed to be called on
an already constructed instance, it is probably better if the method
clears the stack before actually unserializing.
2020-03-06 09:09:49 +01:00
Christoph M. Becker
9dda3b9eb2 Next is 7.3.17 2020-03-03 10:19:31 +01:00
Christoph M. Becker
fc8b3ab7cb Fix #79013: Content-Length missing when posting a curlFile with curl
Unfortunately, some Webservers (e.g. IIS) do not implement the (F)CGI
specifications correctly wrt. chunked uploads (i.e. Transfer-encoding:
chunked), but instead pass -1 as CONTENT_LENGTH to the CGI
application. However, our (F)CFI SAPIs (i.e. cgi and cgi-fcgi) do not
support this.

Therefore we try to retrieve the stream size in advance and pass it to
`curl_mime_data_cb()` to prevent libcurl from doing chunked uploads.
This is basically the same approach that `curl_mime_filedata()`
implements, except that we are keeping already opened streams open for
the `read_cb()`.
2020-03-02 19:11:33 +01:00
Christoph M. Becker
a0377021c5 Native Windows support for mysqlnd sha256 authentification
We implement that on top of Cryptography API: Next Generation (CNG).
2020-03-02 16:32:51 +01:00
Christoph M. Becker
318757551a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79333: com_print_typeinfo() leaks memory
2020-03-02 11:38:03 +01:00
Christoph M. Becker
53140e5c56 Fix #79333: com_print_typeinfo() leaks memory
We have to free the `ansiname`s, regardless of whether they have been
put into the hashtable or not.

Since bug79299.phpt already shows the leak when run with a leak
checker, there is no need for another regression test.
2020-03-02 11:36:30 +01:00
Christoph M. Becker
b9843c9418 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79332: php_istreams are never freed
2020-03-02 10:46:46 +01:00
Christoph M. Becker
2adf1c4d23 Fix #79332: php_istreams are never freed
Releasing the `com_dotnet_istream_wrapper` in `istream_destructor()` is
pointless, since `istream_destructor()` is only called when the
resource is going to be released.  This recursion is not a real issue,
though, since the resource is never exposed to userland, and has at
most refcount 1, so due to well defined unsigned integer underflow, it
never is released twice.  However, returning early in this case causes
a memory leak which needs to be fixed.
2020-03-02 10:45:37 +01:00
Nikita Popov
375191aae7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79062
2020-02-28 17:07:36 +01:00
Nikita Popov
6c48da9a50 Fixed bug #79062
Back up the doc comment when performing heredoc scanahead.
2020-02-28 17:06:05 +01:00
Christoph M. Becker
0bffee4a35 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79311: enchant_dict_suggest() fails on big endian architecture
2020-02-28 15:44:52 +01:00
Christoph M. Becker
6adb885966 Fix #79311: enchant_dict_suggest() fails on big endian architecture
For obvious reasons, we must not assign a `size_t` value to an `int`
variable using memcpy().  However, there is actually no need for the
intermediate `n_sugg_st` here, if we use the proper types in the first
place.

A regression test is not necessary, because dict_suggest.phpt already
exhibits the erroneous behavior on big endian architectures.
2020-02-28 15:43:44 +01:00
Nikita Popov
30ee3f48d4 Fixed bug #79252 2020-02-28 12:47:56 +01:00
Remi Collet
1b40bb76b9 NEWS 2020-02-28 10:36:12 +01:00
Christoph M. Becker
78e04759ad Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64032: mysqli reports different client_version
2020-02-27 09:39:13 +01:00
Christoph M. Becker
8654c32b58 Fix #64032: mysqli reports different client_version
While `mysqli_get_client_version()` calls `mysql_get_client_version()`
to retrieve the client version, `mysql::$client_version` is initialized
to `MYSQL_VERSION_ID`.  Both should match though, and since the former
is the more useful information, we fix `mysql::$client_version`.

We do not add a regression test, because it would usually succeed
anyway, and we already have several tests with respective `assert()`s.
2020-02-27 09:35:04 +01:00
Nikita Popov
1e50c81f6f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #63206: Fully support error/exception_handler stacking, even with null or inside the handler
2020-02-25 12:44:11 +01:00
Mark Plomer
8c6a7c3326 Fix #63206: Fully support error/exception_handler stacking, even with null or inside the handler
Always push the current user_error/exception_handler to the stack,
even when it is empty, so restore_error_handler() always works as
expected.

The user_error_handler is especially temporarily empty when we are inside
the error handler, which caused inconsistent behaviour before.
2020-02-25 12:43:42 +01:00
Nikita Popov
e855b286c8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixes #79265: Improper injection of Host header when using fopen for http requests
2020-02-24 09:51:36 +01:00
Miguel Xavier Penha Neto
d0d60503b5 Fixes #79265: Improper injection of Host header when using fopen for http requests
Check all occurrences of the string "host:" (and other headers),
not just the first one.
2020-02-24 09:50:32 +01:00
Christoph M. Becker
09e7c86779 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79299: com_print_typeinfo prints duplicate variables
2020-02-23 23:34:15 +01:00
Christoph M. Becker
9e6358af36 Fix #79299: com_print_typeinfo prints duplicate variables
`lastid` has to retain its value during the traversal, so we move it to
an outer scope.

Patch contributed by Litiano Moura.
2020-02-23 23:31:36 +01:00
Jakub Zelenka
578a8113eb Fix bug #79014 (PHP-FPM & Primary script unknown) 2020-02-23 19:14:05 +00:00
Jakub Zelenka
0bc6a66a7a Fix bug #77653 (operator displayed instead of the real error message) 2020-02-23 18:29:10 +00:00
Christoph M. Becker
2a76e3a457 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()
2020-02-21 13:37:31 +01:00
Christoph M. Becker
f133f0024e Fix #79294: ::columnType() may fail after SQLite3Stmt::reset()
The fix for feature request #53466 did not properly handle resetting of
the corresponding statement; the problem with this is that the
statement does not know about its result sets.  But even if we could
fix this, the `complete` handling still appears to be brittle, since
the `sqlite3_column_type()`docs[1] state:

| If the SQL statement does not currently point to a valid row, or if
| the column index is out of range, the result is undefined.

Fortunately, we can use `sqlite3_data_count()` instead, since[2]:

| If prepared statement P does not have results ready to return (via
| calls to the sqlite3_column() family of interfaces) then
| sqlite3_data_count(P) returns 0.

Thus, we guard `SQLite3::columnType()` with `sqlite3_data_count()`, and
completely drop updating the `php_sqlite3_result_object.complete`
field, but keep it for ABI BC purposes.

[1] <https://www.sqlite.org/c3ref/column_blob.html>
[2] <https://www.sqlite.org/c3ref/data_count.html>
2020-02-21 13:36:29 +01:00
Christoph M. Becker
1b2e6cb3f5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix NEWS [ci skip]
2020-02-20 10:57:41 +01:00
Christoph M. Becker
ab5b6702d7 Fix NEWS [ci skip]
Cosmetics.
2020-02-20 10:55:17 +01:00
Christoph M. Becker
f6fcc5c353 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Remove extra tab in NEWS [ci skip]
2020-02-18 11:10:51 +01:00
Christoph M. Becker
31dd45564c Remove extra tab in NEWS [ci skip] 2020-02-18 11:09:37 +01:00
Remi Collet
63f6608f89 bump version to 7.2.29 2020-02-18 11:00:28 +01:00
Christoph M. Becker
3090c88f55 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79038: PDOStatement::nextRowset() leaks column values
2020-02-17 22:54:16 +01:00
Christoph M. Becker
08073b0658 Fix #79038: PDOStatement::nextRowset() leaks column values
Firstly, we must not rely on `stmt->column_count` when freeing the
driver specific column values, but rather store the column count in
the driver data.  Since the column count is a `short`, 16 bit are
sufficient, so we can store it in reserved bits of `pdo_odbc_stmt`.

Furthermore, we must not allocate new column value storage when the
statement is not executed, but rather when the column value storage has
not been allocated.

Finally, we have to introduce a driver specific `cursor_closer` to
avoid that `::closeCursor()` calls `odbc_stmt_next_rowset()` which then
frees the column value storage, because it may be still needed for
bound columns.
2020-02-17 22:53:02 +01:00
Christoph M. Becker
8db8d66df0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix NEWS [ci skip]
2020-02-17 19:36:52 +01:00
Christoph M. Becker
16c7c71693 Fix NEWS [ci skip] 2020-02-17 19:35:42 +01:00
Christoph M. Becker
583e7bad79 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS [ci skip]
2020-02-17 19:24:39 +01:00
Christoph M. Becker
788065fb8c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS [ci skip]
2020-02-17 19:23:31 +01:00
Christoph M. Becker
5009b9811d Update NEWS [ci skip] 2020-02-17 19:21:51 +01:00
Christoph M. Becker
73a4c50309 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79271: DOMDocumentType::$childNodes is NULL
2020-02-17 09:09:30 +01:00
Christoph M. Becker
0966941130 Fix #79271: DOMDocumentType::$childNodes is NULL
Dom level 2 core, DOM level 3 core and the DOM living standard agree
that `childNodes` always return a `NodeList`, and never `null`.
2020-02-17 09:07:54 +01:00
Christoph M. Becker
8ec76366d0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix typo in recent bugfix
2020-02-14 09:23:43 +01:00
Christoph M. Becker
392dada1d6 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix typo in recent bugfix
2020-02-14 09:22:51 +01:00
Christoph M. Becker
8308196c97 Fix typo in recent bugfix 2020-02-14 09:21:13 +01:00
Christoph M. Becker
bf8c6519fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77569: Write Acess Violation in DomImplementation
2020-02-13 15:16:09 +01:00
Christoph M. Becker
8ebadd1128 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #77569: Write Acess Violation in DomImplementation
2020-02-13 15:15:05 +01:00
Christoph M. Becker
cec8b24c84 Fix #77569: Write Acess Violation in DomImplementation
We must not assume that the zval IS_STRING.
2020-02-13 15:13:26 +01:00
Nikita Popov
3a51530963 Fixed bug #79257
Replace an existing entry for a given name only if we have a match.
2020-02-11 17:31:48 +01:00
Christoph M. Becker
93b183ed55 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79254: getenv() w/o arguments not showing changes
2020-02-11 11:57:57 +01:00
Christoph M. Becker
7b464ce6f3 Fix #79254: getenv() w/o arguments not showing changes
To be able to see changes done only with `SetEnvironmentVariable()`, we
have to use `GetEnvironmentStrings()` instead of `environ`, because the
latter sees only changes done with `putenv()`.

For best backward compatibility we're using `GetEnvironmentStringsA()`;
switching to the wide string version likely makes sense for master,
though.
2020-02-11 11:47:29 +01:00
Xinchen Hui
6295ff77b7 Fixed bug #79244 (php crashes during parsing INI file). (Laruence)
Cherry-picked the fix(not sure why this wasn't merged to 7.4) for:
Fixed bug #77589 (Core dump using parse_ini_string with numeric sections)

Section name should not be typed(NULL, FALSE, TRUE etc)

Conflicts:

	Zend/zend_ini_scanner.c
2020-02-10 13:01:51 +08:00
Christoph M. Becker
01eab11cee Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79248: Traversing empty VT_ARRAY throws com_exception
2020-02-08 17:07:02 +01:00
Christoph M. Becker
f649adedfe Fix #79248: Traversing empty VT_ARRAY throws com_exception
If the `VT_ARRAY` is empty, i.e. its upperbound is less than its lower
bound, we must not call `php_com_safearray_get_elem()`, because that
function throws in this case.
2020-02-08 17:05:29 +01:00
Christoph M. Becker
b4f61d99cf Fix #79247: Garbage collecting variant objects segfaults
variant objects have no (declared) properties, so the `get_properties`
handlers returns a pointer to constant storage for efficiency reasons.
This pointer must not be returned from the `get_gc` handler, though;
instead we set up an own `get_gc` handler and return NULL from it, to
signal that there are no properties to collect.
2020-02-08 11:03:52 +01:00
Christoph M. Becker
7f86f9972e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79242: COM error constants don't match com_exception codes
2020-02-07 18:05:10 +01:00
Christoph M. Becker
b9738f5802 Fix #79242: COM error constants don't match com_exception codes
Because a `HRESULT` is a `LONG`[1], no special treatment is required on
x86 platforms to get appropriate values.  On x64 platforms we prefer
positive values, what we could accomplish by casting the `HRESULT`
value to `ULONG` and then to `zend_long`, but since the current
behavior is correct and the performance improvement is negligible, we
defer that to master.

[1] <https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types#hresult>
2020-02-07 18:04:14 +01:00
Nikita Popov
cd5591a28d PCRE: Only remember valid UTF-8 if start offset zero
PCRE only validates the string starting from the start offset
(minus maximum look-behind, but let's ignore that), so we can
only remember that the string is fully valid UTF-8 is the original
start offset is zero.
2020-02-07 17:01:39 +01:00
Christoph M. Becker
0d49cf4ed2 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
2020-02-06 15:01:12 +01:00
Christoph M. Becker
5e2ea00b15 Fix #66322: COMPersistHelper::SaveToFile can save to wrong location
Saving under the given `filename` may also work, but since
`::LoadFromFile` uses the `fullpath` we follow suit.
2020-02-06 14:59:55 +01:00
Christoph M. Becker
1cffc7b97a Fix NEWS [ci skip]
This bugfix didn't make it into 7.4.3.
2020-02-06 10:49:05 +01:00
Nikita Popov
e30f52b919 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79188
2020-02-05 11:21:25 +01:00
Nikita Popov
13bfa9f5ac Fixed bug #79188 2020-02-05 11:18:46 +01:00
Christoph M. Becker
e3632fdc0d Next is 7.3.16 2020-02-04 11:38:29 +01:00
Christoph M. Becker
2d0dec91a5 Fix #79019: Copied cURL handles upload empty file
To cater to `curl_copy_handle()` of cURL handles with attached
`CURLFile`s, we must not attach the opened stream, because the stream
may not be seekable, so that we could rewind, when the same stream is
going to be uploaded multiple times.  Instead, we're opening the stream
lazily in the read callback.

Since `curl_multi_perfom()` processes easy handles asynchronously, we
have no control of the operation sequence.  Since duplicated cURL
handles may be used with multi handles, we cannot use a single arg
structure, but actually have to rebuild the whole mime structure on
handle duplication and attach this to the new handle.

In order to better test this behavior, we extend the test responder to
print the size of the upload, and patch the existing tests accordingly.
2020-02-04 11:09:28 +01:00
Christoph M. Becker
a0c93bf65e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78090: bug45161.phpt takes forever to finish
2020-02-04 00:45:54 +01:00
Christoph M. Becker
079905acd5 Fix #78090: bug45161.phpt takes forever to finish
Not all systems support the discard protocol (TCP port 9), and since
there is no particular reason to use it, we switch to using actual
server testing.
2020-02-04 00:44:04 +01:00
Christoph M. Becker
3fb41c2028 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
2020-02-03 23:33:20 +01:00
Christoph M. Becker
fe1bfb78d6 Fix #79191: Error in SoapClient ctor disables DOMDocument::save()
The culprit is the too restrictive fix for bug #71536, which prevents
`php_libxml_streams_IO_write()` from properly executing when unclean
shutdown is flagged.  A *more* suitable solution is to move the
`xmlwriter_free_resource_ptr()` call from the `free_obj` handler to an
added `dtor_obj` handler, to avoid to write to a closed stream in case
of late object freeing.  This makes the `EG(active)` guard superfluous.

We also fix bug79029.phpt which has to use different variables for the
three parts to actually check the original shutdown issue.

Thanks to bwoebi and daverandom for helping to investigate this issue.
2020-02-03 23:31:46 +01:00
Christoph M. Becker
57b9eca83d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79212: NumberFormatter::format() may detect wrong type
2020-02-03 12:29:43 +01:00
Christoph M. Becker
c2935499b1 Fix #79212: NumberFormatter::format() may detect wrong type
We have to convert to number *before* detecting the type, to cater to
internal objects implementing `cast_object`.

We also get rid of the fallback behavior of using `FORMAT_TYPE_INT32`,
because that can no longer happen; after `convert_scalar_to_number_ex`
the type is either `IS_LONG` or `IS_DOUBLE`.  We cater explicitly to
the `IS_ARRAY` case what also avoids triggering a type confusion when
`::TYPE_INT64` is passed as `$type`.
2020-02-03 12:28:32 +01:00
Remi Collet
846e52bd45 NEWS 2020-02-03 10:10:17 +01:00
Nikita Popov
d422478f6d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #76047
2020-01-31 10:29:45 +01:00
Nikita Popov
ef1e4891b4 Fix bug #76047
Unlink the current stack frame before freeing CVs or extra args.
This means it will no longer show up in back traces that are
generated during CV destruction.

We already did this prior to destructing the object/closure,
presumably for the same reason.
2020-01-31 10:26:40 +01:00
Nikita Popov
f70b552326 Fixed bug #79193 2020-01-30 14:55:58 +01:00
Christoph M. Becker
dfbeee034a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70078: XSL callbacks with nodes as parameter leak memory
2020-01-30 13:06:25 +01:00
Christoph M. Becker
8226e704e4 Fix #70078: XSL callbacks with nodes as parameter leak memory
The fix for bug #49634 solved a double-free by copying the node with
`xmlDocCopyNodeList()`, but the copied node is later freed by calling
`xmlFreeNode()` instead of `xmlFreeNodeList()`, thus leaking memory.
However, there is no need to treat the node as node list, i.e. to copy
also the node's siblings; just creating a recursive copy of the node
with `xmlDocCopyNode()` is sufficient, while that also avoids the leak.
2020-01-30 13:04:57 +01:00
Remi Collet
bdcfdd4402 zip: more constants 2020-01-29 14:25:16 +01:00
Máté Kocsis
d39edebbce
Fix #78666 mysqli_options generates Warning on var_dump()
Closes GH-5121
2020-01-28 18:44:02 +01:00
Christoph M. Becker
addc3c92f2 Fix #79174: cookie values with spaces fail to round-trip
The fix for bug #78929 disabled the conversion of spaces in cookie
values to plus signs, but failed to adapt `php_setcookie()`
accordingly, so that it uses raw URL encoding as well.
2020-01-28 15:37:01 +01:00
Nikita Popov
1146bdb9b2 Fixed bug #78989
Always operate on copies of the functions, so we don't reference
temporary trait methods that have gone out of scope.

This could be more efficient, but doing an allocated copy only when
strictly necessary turned out to be somewhat tricky.
2020-01-28 10:43:15 +01:00
Christoph M. Becker
e197f65b35 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #76584: PharFileInfo::decompress not working
2020-01-28 10:33:10 +01:00
Christoph M. Becker
136f51f1e1 Fix #76584: PharFileInfo::decompress not working
We actually have to decompress, when told to do so.
2020-01-28 10:31:36 +01:00
Remi Collet
5215f072af - bump zip extension version to 1.15.6
- add ZipArchive::LIBZIP_VERSION
- skip bug53885.phpt with libzip 1.6.0 (empty file is no more valid archive)
2020-01-27 16:47:28 +01:00
Máté Kocsis
ea1b878877
Fix #78969 Make PASSWORD_DEFAULT match PASSWORD_BCRYPT instead of being null
It was an unintentional BC break.
2020-01-27 13:57:00 +01:00
Nikita Popov
1cccbb8ff1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78323: Code 0 is returned on invalid options
2020-01-27 13:32:38 +01:00
Ivan Mikheykin
fd08f062ae Fix bug #78323: Code 0 is returned on invalid options
Set CLI exit code to 1 when invalid parameters are passed,
and print error to stderr.
2020-01-27 13:32:19 +01:00
Nikita Popov
3291891408 Fixed bug #79128
We need to extend the hash table before performing raw append
operations.

This doesn't matter if preloading happens in the same process,
as the tables will be large enough to hold all entries as a
side-effect of the preloading process. However, if preloading
happens in a different process, we need to reserve space here.
2020-01-24 16:18:48 +01:00
Nikita Popov
bb5cdd9b74 Fixed bug #79011
auth_plugin_data_len here is 21, including the trailing null byte.
Directly use SCRAMBLE_LENGTH instead. Also add a sanity check that
the provided scramble is long enough.
2020-01-24 14:54:46 +01:00
Remi Collet
b9dff1160e Add ZipArchive::CM_LZMA2 constant (since libzip 1.6.0) 2020-01-24 14:06:19 +01:00
Nikita Popov
6489e29831 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78902
  Add unit test for bug #78902
2020-01-23 14:58:10 +01:00
liudaixiao
67421a780d Fixed bug #78902 2020-01-23 14:57:16 +01:00
Nikita Popov
db9776c53c Fixed bug #79151
Make sure we also NULL out next/prev of the removed element on
pop/shift. This only matter is that element is still being referenced
by an iterator.
2020-01-23 14:20:26 +01:00
Nikita Popov
2eb33818b6 Fixed bug #79155
Make sure we only unset the NULLABLE flag temporarily for class
resolution, as the same type may be compiled multiple types.
2020-01-23 12:54:14 +01:00
Christoph M. Becker
9be31a582a Fix #79154: mb_convert_encoding() can modify $from_encoding
We must not modify arrays passed by value.
2020-01-22 10:28:07 +01:00
Christoph M. Becker
94c9dc498f Fix #79149: SEGV in mb_convert_encoding with non-string encodings
We must not assume that `hash_entry` `IS_STRING`, but rather use
`encoding_str` which is guaranteed to be.
2020-01-22 09:43:51 +01:00
Remi Collet
7e2bd95fa5 next will be 7.2.28 2020-01-22 09:17:00 +01:00
Christoph M. Becker
16a8a608d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79145: openssl memory leak
2020-01-21 16:20:04 +01:00
Christoph M. Becker
9eff906a02 Fix #79145: openssl memory leak
We must increase the refcount of `return_value` only if `cert` is a
resource; this is already done in `php_openssl_evp_from_zval()`,
though.
2020-01-21 16:17:25 +01:00
Christoph M. Becker
b0f8d38f4a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79146: cscript can fail to run on some systems
2020-01-21 11:54:11 +01:00
Deus Kane
3046e35718 Fix #79146: cscript can fail to run on some systems
In the buildconf and configure batch files, Windows' cscript utility was being
run without the /e:jscript flag. This works on systems that have not had the
default .js file association changed, but if .js has been re-associated to
(say) an IDE, the batch files fail with the error message:

Input Error: There is no script engine for file extension ".js".
2020-01-21 11:53:11 +01:00
Christoph M. Becker
b67fc51859 Update NEWS wrt. sec fixes 2020-01-21 11:31:14 +01:00
Stanislav Malyshev
5c90f8eb66 Update NEWS 2020-01-20 22:12:32 -08:00
Nikita Popov
74380465ec Fix bug #79112: IMAP can't find OpenSSL during configure
Remove the check of PHP_OPENSSL inside SETUP_OPENSSL. It's the
responsibility of the caller to determine whether they want to
enable openssl or not. This makes SSL detection in IMAP work,
which uses a different option.

Additionally also clarify that --with-openssl-dir cannot actually
be used to specify an OpenSSL directory -- these options just
serve as a way to enable OpenSSL in extensions without also
enabling the OpenSSL extension. They need to be renamed to
something clearer in master.

Closes GH-5091.
2020-01-20 09:59:27 +01:00
Xinchen Hui
9c2fd55d01 Fixed bug #79114 (Eval class during preload causes class to be only half available) 2020-01-20 12:24:49 +08:00
Nikita Popov
384dfe331b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79115
2020-01-17 11:38:10 +01:00
Nikita Popov
07bda97e76 Fixed bug #79115 2020-01-17 11:37:35 +01:00
Nikita Popov
018251a7c4 Fixed bug #71876
This is a backport of fcdc0a6db0
to the PHP-7.3 branch. We need to make sure that OnUpdateString
is also called for a NULL value, otherwise the reset of the encoding
at the end of the request will not work.

I believe I already tried to land this before once, but it didn't
actually end up on the PHP-7.3 branch due to a push conflict that
I only noticed just now.
2020-01-17 09:47:31 +01:00
Christoph M. Becker
05f3cd23ed Fix #79096: FFI Struct Segfault
We must not assume that the size of a function's return value is at
most `sizeof(ffi_arg)`, but rather have to use the size which already
has been determined for the return type if it is larger than
`sizeof(ffi_arg)`.

To be able to have a regression test, we export the required test
function from the zend-test extension, and make sure that the test
can be run on different platforms regardless of whether zend-tests was
built statically or dynamically.
2020-01-14 16:46:58 +01:00
Christoph M. Becker
b0cdd8cc53 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:23:12 +01:00
Christoph M. Becker
1752393bb4 Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
Column names can be numeric strings, so we have to make sure to insert
the column values with the appropriate numeric keys, instead of adding
them.
2020-01-13 13:21:45 +01:00
Christoph M. Becker
b2864b7cfd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79078: Hypothetical use-after-free in curl_multi_add_handle()
2020-01-08 18:31:38 +01:00
Christoph M. Becker
0dda4a844e Fix #79078: Hypothetical use-after-free in curl_multi_add_handle()
To avoid this, we have to verify the handlers already in
`curl_multi_add_handle()`, not only in `curl_multi_exec()`.
2020-01-08 18:29:10 +01:00
Christoph M. Becker
7ea4f0e47e Bump version 2020-01-08 18:26:14 +01:00
Christoph M. Becker
38c0a53b60 Bump version 2020-01-07 11:03:19 +01:00
Nikita Popov
59c3ddab13 Remove support for preloading on Windows
Due to ASLR restrictions, preloading on Windows does not work with
any code that has preloading dependencies on internal classes.
This effectively makes it unusable for any non-trivial codebase.

Instead of pretending like preloading is going to work, only to
make people realize that it really doesn't once they get beyond
a dummy example, we disable support for preloading on Windows
entirely.

Closes GH-4999.
2020-01-06 22:41:55 +01:00
Nikita Popov
846b647953 Throw Error when referencing uninit typed prop in __sleep
Previously this generated a notice, but would likely generate an
Error when unserializing.

Now we treat it with the same distinction as direct property
accesses, i.e. referencing an unset/undefined normal property
stays a notice, while a typed property becomes an Error exception.

This fixed bug #79002.

Closes GH-5050.
2020-01-06 18:47:27 +01:00
Christoph M. Becker
06e78cad83 Revert "Extend CURLFile to support streams"
This reverts commit 17a9f1401a, because
this commit would break ABI, and also due to bug #79013.
We keep the commit for PHP 7.4+, though.
2020-01-06 15:31:49 +01:00
Christoph M. Becker
09ebeba1af Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #54298: Using empty additional_headers adding extraneous CRLF
2020-01-06 14:48:46 +01:00
Christoph M. Becker
ae2150692a Fix #54298: Using empty additional_headers adding extraneous CRLF
If the header string is empty, we pass `NULL` to `php_mail()` to avoid
further checks on the string length.
2020-01-06 14:47:23 +01:00
Christoph M. Becker
74b11e3315 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79068: gdTransformAffineCopy() changes interpolation method
2020-01-06 10:38:22 +01:00
Christoph M. Becker
4bec59f175 Fix #79068: gdTransformAffineCopy() changes interpolation method
We port
<9088591eae>.
2020-01-06 10:36:48 +01:00
Nikita Popov
b59f760472 Fix bug #79063: Curl openssl does not respect PKG_CONFIG_PATH 2020-01-06 10:31:22 +01:00
Christoph M. Becker
f799f42ec8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79067: gdTransformAffineCopy() may use unitialized values
2020-01-06 09:37:40 +01:00
Christoph M. Becker
2c5860517c Fix #79067: gdTransformAffineCopy() may use unitialized values
We port
<7a06c1669c>.
2020-01-06 09:35:13 +01:00
Christoph M. Becker
f4aa0869ac Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78808: [LMDB] MDB_MAP_FULL: Environment mapsize limit reached
2020-01-03 18:51:07 +01:00
Christoph M. Becker
c05a069adf Fix #78808: [LMDB] MDB_MAP_FULL: Environment mapsize limit reached
We implement support for a fifth parameter, which allows to specify the
mapsize.  The parameter defaults to zero, in which case the compiled in
default mapsize (usually 1048576) will be used.  The mapsize should be
a multiple of the page size of the OS.
2020-01-03 18:49:12 +01:00
Christoph M. Becker
4c6ad099c6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78538: shmop memory leak
2020-01-03 18:13:04 +01:00
Christoph M. Becker
18172303f4 Fix #78538: shmop memory leak
If the descriptor's refcount drops to zero, we have to unmap the
respective file view, to avoid leaking memory.
2020-01-03 18:10:29 +01:00
Christoph M. Becker
40b2f82380 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79015: undefined-behavior in php_date.c
2020-01-03 14:32:30 +01:00
Christoph M. Becker
b48f2625b5 Fix #79015: undefined-behavior in php_date.c
We check that the given microsecond fraction is in the valid range
[0, 1000000[, and otherwise mark it as invalid.  We also drop the
useless do loop; a plain block is sufficient here.
2020-01-03 14:31:03 +01:00
Nikita Popov
1dcdcd79ba Fixed bug #79056 2020-01-03 11:08:48 +01:00
Nikita Popov
8abb2ced39 Fixed bug #79055
Fix file cache serialization of property types. I'm changing the
overall type serialization format to perform additional adjustments
in order to yield a plausible pointer for zend_type, rather than
using an entirely separate serialization format, as was previously
done. That would have been annoying to extend to the case of CE
pointers.
2020-01-02 15:53:15 +01:00
Nikita Popov
d1537e506e Fixed bug #79046 2019-12-30 17:23:53 +01:00
Christoph M. Becker
94063619a0 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79040: Warning Opcode handlers are unusable due to ASLR
2019-12-30 15:17:41 +01:00
Christoph M. Becker
0cecf83b26 Fix #79040: Warning Opcode handlers are unusable due to ASLR
We must not use the same shared memory OPcache instance for different
SAPIs, since their memory layout is different.  To avoid this, we add
the SAPI name (truncated to at most 20 characters) to the names of the
memory base file, the mutex and the file mapping.
2019-12-30 15:12:58 +01:00
Nikita Popov
fcaf7cbd64 Add test for bug #79031
Fixed by preceding revert.
2019-12-30 11:31:27 +01:00
Christoph M. Becker
6d1dff6f3d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79033: Curl timeout error with specific url and post
2019-12-28 10:48:59 +01:00
Christoph M. Becker
c47b18a222 Fix #79033: Curl timeout error with specific url and post
We must not set an empty mime structure as `CURLOPT_MIMEPOST`; instead
we set it to `NULL` if `CURLOPT_POSTFIELDS` has been set to an empty
array.
2019-12-28 10:47:03 +01:00
Christoph M. Becker
1b0a79ab3f Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
2019-12-25 12:35:44 +01:00
Xinchen Hui
27bb3289ac Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter).
We backport the fix PHP 7.3, since this branch is affected as well.

(cherry picked from commit b5e0043796)
(cherry picked from commit e36daa6927)
(cherry picked from commit 2704ee6844)
2019-12-25 12:33:30 +01:00
Xinchen Hui
e36daa6927 Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter). 2019-12-25 15:55:15 +08:00
Xinchen Hui
4c6e170c57 Revert "Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter)"
This reverts commit d8ad2f4695.
2019-12-25 15:27:10 +08:00
Xinchen Hui
d8ad2f4695 Fixed bug #79029 (Use After Free's in XMLReader / XMLWriter) 2019-12-25 13:14:08 +08:00
Xinchen Hui
153c9cc346 Fixed bug #79022 (class_exists returns True for classes that are not ready to be used) 2019-12-24 14:04:19 +08:00
Christoph M. Becker
6ec4056928 Fix #79008: General performance regression with PHP 7.4 on Windows
We no longer try to retrieve the filename of a given stream when
fstat'ing, because this is very slow.  Since we neither didn't do that
in PHP 7.3 and earlier, we regard this as sensible trade-off.
2019-12-20 16:28:11 +01:00
Nikita Popov
b0737fa35e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78982: pdo_pgsql returns dead persistent connection
2019-12-20 12:06:05 +01:00
SATO Kentaro
37d11d123e Fix #78982: pdo_pgsql returns dead persistent connection
Call PQconsumeInput() before PQstatus() to update the status.
2019-12-20 12:05:17 +01:00
Nikita Popov
f974f252dd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78980: pgsqlGetNotify() overlooks dead connection
2019-12-20 11:45:16 +01:00
SATO Kentaro
7e39e6934d Fix #78980: pgsqlGetNotify() overlooks dead connection
pgsqlGetNotify() didn't check result of PQconsumeInput().
2019-12-20 11:44:07 +01:00
Nikita Popov
10eb0b3110 Fixed bug #79000
Don't report EAGAIN/EWOULDBLOCK as errors for fwrite on
non-blocking socket streams. This matches behavior for fread,
as well as behavior for plain file streams.

Closes GH-5026.
2019-12-20 11:37:43 +01:00
Sergei Turchanov
c62cd9a43a Fix #74170: locale information change after mime_content_type
Some functions in libmagic (distributed with fileinfo extension) perform this sequence of calls:
func() {
setlocale(LC_TYPE, "C")
.. do some work ..
setlocale(LC_TYPE, "")
}

It effectively resets LC_TYPE if it that was set before the function call.

To avoid manipulations with current locale at all, the problematic functions
were modified to use locale-independent functions.
2019-12-20 11:22:59 +01:00
SATO Kentaro
cbb0efaeeb Fix #78402: pcntl_signal() misleading error message
An error message can be misleading when a handler
passed to pcntl_signal() is not callable.
2019-12-20 11:02:20 +01:00
Dmitry Stogov
66d5b0608a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78999 (Cycle leak when using function result as temporary)
2019-12-19 23:17:39 +03:00
Dmitry Stogov
eb846939b1 Fixed bug #78999 (Cycle leak when using function result as temporary) 2019-12-19 23:11:08 +03:00
Christoph M. Becker
7e05f97fa6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78983: pdo_pgsql config.w32 cannot find libpq-fe.h
2019-12-19 13:21:23 +01:00
SATO Kentaro
3e35b08980 Fix #78983: pdo_pgsql config.w32 cannot find libpq-fe.h
When configured with a path specified.
2019-12-19 13:20:43 +01:00
Nikita Popov
4a61d842e7 Fixed bug #78776
By using the normal inheritance check if the parent is abstract
as well.
2019-12-18 15:55:45 +01:00
Remi Collet
76eb30ded3 fix release date 2019-12-18 14:18:03 +01:00
Remi Collet
bacfae8baf fix release date 2019-12-18 14:17:31 +01:00
Remi Collet
864f5ef12f fix release date 2019-12-18 14:16:19 +01:00
Nikita Popov
bd4fce4f6f Fixed bug #78986
Don't assume that handlers live in the arena, they may also be in
SHM.
2019-12-18 11:40:58 +01:00
Christoph M. Becker
4cd6d384bd Fix #78976: SplFileObject::fputcsv returns -1 on failure
`php_stream_write()` returns `-1` on failure now, which has to be
catered to by `SplFileObject::fputcsv()` which still is supposed to
return `false` on failure.
2019-12-17 17:52:18 +01:00
Christoph M. Becker
3d50131ef7 Update/fix NEWS [ci skip] 2019-12-17 10:04:42 +01:00
Stanislav Malyshev
0e413241ec [ci skip] Update NEWS 2019-12-16 23:45:11 -08:00
Stanislav Malyshev
9705e631a4 [ci skip] Update NEWS 2019-12-16 23:41:04 -08:00
Nikita Popov
11b041d3c6 Fixed bug #78973
Save opline in leave helper to correctly handle destructor calls
during CV freeing (or other leave freeing).
2019-12-16 18:52:30 +01:00
Dmitry Stogov
6ef7e53c1b Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS) 2019-12-16 12:24:47 +03:00
Nikita Popov
0f2cdbf214 Introduce extra counter to avoid RTD key collisions
Also generate a fatal error if a collision occurs in zend_compile.

This is not perfect, because collisions might still be introduced
via opcache, if one file is included multiple times during a request,
invalidate in the meantime and recompiled by different processes.

This still needs to be addressed, but this patch fixes the much
more common case of collisions occuring when opcache is not used.

Fixes bug #78903.
2019-12-13 11:04:44 +01:00
Kachalin Alexey
79376ab209 Fix #78929: plus signs in cookie values are converted to spaces
We switch the cookie value parsing function from `php_url_decode()` to
`php_raw_url_decode()`, so that cookie values are now parsed according
to RFC 6265, section 4.1.1.  We also refactor to remove duplicate code
without changing the execution flow.
2019-12-12 14:21:46 +01:00
Nikita Popov
be89a5c7f1 Fixed bug #78950: Preloading trait method with static variables
We need to make sure that trait methods with static variables
allocate a separate MAP slot for the static variables pointer,
rather than working in-place.
2019-12-12 11:52:43 +01:00
Nikita Popov
502cd7b1f1 Revert "Fixed bug #78903: Conflict in RTD key for closures results in crash"
This reverts commit b55033fa18.

This breaks ext/opcache/tests/bug65915.phpt.
2019-12-11 14:38:48 +01:00
Nikita Popov
b55033fa18 Fixed bug #78903: Conflict in RTD key for closures results in crash
I wasn't able to create a simple reproducer for this. General approach
is the same as for anonymous classes: If the key is already used, reuse
the old definition.
2019-12-11 13:07:45 +01:00
Derick Rethans
2badeb511b PHP-7.4 is now 7.4.2-dev 2019-12-10 16:56:33 +00:00
Nikita Popov
3f86adb0ef Fixed bug #78935: Check that all linked classes can be preloaded
During preloading, check that all classes that have been included
as part of the preload script itself (rather than through opcache_compile_file)
can actually be preloaded, i.e. satisfy Windows restrictions, have
resolved initializers and resolved property types. When resolving
initializers and property types, also autoload additional classes.
Because of this, the resolution runs in a loop.
2019-12-10 13:05:48 +01:00
Christoph M. Becker
505cc77cbe Fix #78912: INTL Support for accounting format
We provide `NumberFormatter::CURRENCY_ACCOUNTING` to wrap
`UNUM_CURRENCY_ACCOUNTING `[1].

[1] <https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unum_8h.html#a4eb4d3ff13bd506e7078b2be4052266dae97cdd7ed612d07d251021c076efb1c5>
2019-12-09 16:34:56 +01:00
Dmitry Stogov
42a2fb8411 Fixed bug #78895 (Reflection detects abstract non-static class as abstract static. IS_IMPLICIT_ABSTRACT is not longer used) 2019-12-09 13:49:12 +03:00
Christoph M. Becker
17a9f1401a Extend CURLFile to support streams
Due to former restrictions of the libcurl API, curl multipart/formdata
file uploads supported only proper files.  However, as of curl 7.56.0
the new `curl_mime_*()` API is available (and already supported by
PHP[1]), which allows us to support arbitrary *seekable* streams, which
is generally desirable, and particularly resolves issues with the
transparent Unicode and long part support on Windows (see bug #77711).

Note that older curl versions are still supported, but CURLFile is
still restricted to proper files in this case.

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

(cherry picked from commit c68dc6b5e3)
2019-12-09 10:30:00 +01:00
Nikita Popov
32c1f37574 Fixed bug #78926: Handle class table reallocation on failed link
When we change back the bucket key on a class linking failure,
make sure to reload the bucket pointer, as the class table may
have been reallocated in the meantime.

Also remove a bogus bucket key change in anon class registration:
We don't actually rename the class in this case anymore, the RTD
key is already the final name.
2019-12-09 09:15:27 +01:00
Nikita Popov
84354c62b3 Fixed bug #78904: Don't call any magic for uninitialized typed properties
We already changed the behavior for __set() in f1848a4. However, it
seems that this is also a problem for all the other property magic,
see bug #78904.

This commit makes the behavior of all the property magic consistent:
Magic will not be triggered for uninitialized typed properties, only
explicitly unset() ones. This brings behavior more in line how
non-typed properties behave and avoids WTF.

Closes GH-4974.
2019-12-09 08:40:53 +01:00
Jakub Zelenka
ac042f839f Fix bug #78916 (php-fpm 7.4.0 don't send mail via mail()) 2019-12-08 17:57:17 +00:00
Christoph M. Becker
aba070e630 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78923: Artifacts when convoluting image with transparency
2019-12-07 12:08:30 +01:00
willson-chen
b5d2cbe027 Fix #78923: Artifacts when convoluting image with transparency
We have to properly initialize `pxl` before using it.

Fix ported from <https://github.com/libgd/libgd/pull/559>.
2019-12-07 12:06:33 +01:00
Arjen de Korte
ee4295b4ce Fix bug #78823: add zlib library to mysqlnd
The problem is newer binutils will no longer default to --copy-dt-needed-entries but use --no-copy-dt-needed-entries instead. So all libraries needed *must* be provided.

Workarounds (either one works)
1) Add "-Wl,--copy-dt-needed-entries" to LDFLAGS to bring back the old behavior of the linker
2) Add "-lz" to list of libraries to be added

In "ext/mysqlnd/mysqlnd_protocol_frame_codec.c" when the "zlib.h" header is included should also trigger adding '-lz' to the list of libraries.
2019-12-05 07:24:52 +01:00
Nikita Popov
6540797f1e Fixed bug #78898 2019-12-04 09:40:48 +01:00
Christoph M. Becker
65bbc67063 Next is 7.3.14 2019-12-03 12:04:17 +01:00
Remi Collet
d2cfb63f02 next is 7.2.27 2019-12-03 11:25:37 +01:00
Christoph M. Becker
996f217aa5 Fix #78883: fgets(STDIN) fails on Windows
We add the `is_seekable` member to `php_stdio_stream_data`, and prefer
that over `is_pipe`, since the latter is simply a misnomer.  We keep
`is_pipe` for now for Windows only, though, because we need special
support for pipes there.  We also fix the misaligned bitfield which
formerly took 33 bit.
2019-12-02 16:52:32 +01:00
Christoph M. Becker
3356dd0575 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:39:35 +01:00
Christoph M. Becker
861fa60814 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78814: strip_tags allows / in tag name => whitelist bypass
2019-12-02 11:38:45 +01:00
Christoph M. Becker
600f1f898f Fix #78814: strip_tags allows / in tag name => whitelist bypass
When normalizing tags to check whether they are contained in the set
of allowable tags, we must not strip slashes, unless they come
immediately after the opening `<`, or immediately before the closing
`>`.
2019-12-02 11:37:25 +01:00
Christoph M. Becker
a9e45bc0fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78296: is_file fails to detect file
2019-12-02 11:29:58 +01:00
Christoph M. Becker
bb735c9e9e Fix #78296: is_file fails to detect file
If we're constructing extended-length paths (i.e. paths prefixed with
`\\?\`), we have to replace all forward slashes with backward slashes,
because the former are not supported by Windows for extended-length
paths.

The more efficient and likely cleaner alternative solution would be to
cater to this in `php_win32_ioutil_normalize_path_w()` by always
replacing forward slashes, but that might break existing code.  It
might be sensible to change that for `master`, though.
2019-12-02 11:29:10 +01:00
Christoph M. Becker
4ff242a9a7 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78833: Integer overflow in pack causes out-of-bound access
2019-12-02 11:21:07 +01:00
Christoph M. Becker
3d81c54879 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78833: Integer overflow in pack causes out-of-bound access
2019-12-02 11:19:15 +01:00
Christoph M. Becker
db420cb6a1 Fix #78833: Integer overflow in pack causes out-of-bound access
We check for potential signed integer overflow, and bail out
gracefully, in that case.
2019-12-02 11:18:19 +01:00
Jakub Zelenka
67cd4271e9 Fix bug #78889 (php-fpm service fails to start) 2019-12-01 17:13:20 +00:00
Christoph M. Becker
1979c5d16f Upgrade to Oniguruma 6.9.4
Oniguruma 6.9.4 fixes several CVEs.
2019-11-30 14:00:41 +01:00
Christoph M. Becker
30aa2e8932 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78840: imploding $GLOBALS crashes
2019-11-27 09:33:55 +01:00
Christoph M. Becker
fee38633d2 Fix #78840: imploding $GLOBALS crashes
We add support for IS_INDIRECT zvals to implode().
2019-11-27 09:32:16 +01:00
Christoph M. Becker
717730ddd1 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #77638: var_export'ing certain class instances segfaults
2019-11-25 15:57:56 +01:00
Christoph M. Becker
23c65a8173 Fix #77638: var_export'ing certain class instances segfaults
If objects return immutable property hash tables (typically,
`zend_empty_array`), we must not try to apply recursion protection on
those.
2019-11-25 15:54:11 +01:00
Dmitry Stogov
2ebf530946 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value)
2019-11-25 14:09:18 +03:00
Dmitry Stogov
bb30fe9e2b Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) 2019-11-25 14:05:43 +03:00
Derick Rethans
71d42dc794 Consolidate NEWS for 7.4.0 release 2019-11-24 10:23:33 +01:00
Derick Rethans
c16cbfd1da WIP: Merge NEWS 2019-11-23 20:00:51 +01:00
Christoph M. Becker
cfb643ca2b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78853: preg_match() may return integer > 1
2019-11-22 19:29:11 +01:00
Christoph M. Becker
e1da72bdf1 Fix #78853: preg_match() may return integer > 1
Commit 54ebebd[1] optimized the match loop, but for this case it has
been overlooked, that we must only loop if we're doing global matching.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=54ebebd686255c5f124af718c966edb392782d4a>
2019-11-22 19:26:26 +01:00
Christoph M. Becker
b78ec58f09 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:02:33 +01:00
Christoph M. Becker
b4f501d5a4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
2019-11-21 10:01:05 +01:00
Christoph M. Becker
9b92c1d154 Fix #78849: GD build broken with -D SIGNED_COMPARE_SLOW
Apparently, this has not been tested for a long time, and might be a
refactoring relict.  Anyhow, we have to pass the context to
`GIFNextPixel` as well.
2019-11-21 09:59:26 +01:00
Christoph M. Becker
bcb8ab304e Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
2019-11-18 12:48:55 +01:00
Christoph M. Becker
3b46fbfc36 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Update NEWS
2019-11-18 12:47:53 +01:00
Christoph M. Becker
f6eac76b65 Update NEWS 2019-11-18 12:46:43 +01:00
Jakub Zelenka
29c7c9e8ed Add NEWS entry for bug #76601 fix 2019-11-17 14:52:36 +00:00
Nikita Popov
266f3a02bc Fixed bug #78810 2019-11-15 12:06:17 +01:00
Christoph M. Becker
39d04f15f8 Fix ASLR related invalid opline handler issues
Opcache stores `opline->handler`s in shared memory.  These pointers are
invalid, if the main PHP DLL is loaded at another base address due to
ASLR.  We therefore store the address of `execute_ex` in the mmap base
file, and check on startup whether it matches its current address.  If
not, we fall back on the file cache if enabled, and bail out otherwise.

This still does not address cases where the opline handler is located
inside of another DLL (e.g. for some profilers, debuggers), but there
seems to be no general solution for now.

(cherry picked from commit 8ba10b8fbc)
2019-11-15 09:46:58 +01:00
Stanislav Malyshev
2c9926f156 Fix bug #78804 - Segmentation fault in Locale::filterMatches 2019-11-11 22:32:35 -08:00
Dmitry Stogov
ecd0c5b6ad Fixed bug #78714 (funcs returning pointer can't use call convention spec) 2019-11-11 12:07:48 +03:00
Nikita Popov
aed4f6e849 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78759
2019-11-07 11:17:14 +01:00
Nikita Popov
8d2a9d8859 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78759
2019-11-07 11:16:24 +01:00
Nikita Popov
5fa6dcd972 Fixed bug #78759
Handle INDIRECT values in array.
2019-11-07 11:15:29 +01:00
max
0988f69634 Fix #78788: ./configure generates invalid php_version.h
Change $SED to "${SED}" such that the IFS is not used to split the
output of that variable.
2019-11-07 10:01:02 +01:00
Nikita Popov
6d4965febd Fixed bug #78787
Not the first time inheritance of shadow properties causes an issue,
thankfully this whole concept is gone in PHP 7.4.
2019-11-06 12:52:34 +01:00
Christoph M. Becker
4c9ba3e042 7.3.13 is next 2019-11-05 18:20:56 +01:00
Sara Golemon
d317e16e89
Bump for 7.2.26-dev 2019-11-05 10:57:29 -05:00
Nikita Popov
3e41ade638 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #78775
2019-11-05 12:16:09 +01:00
Nikita Popov
747cb46244 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78775
2019-11-05 12:15:44 +01:00
Nikita Popov
4f984a2fdb Fixed bug #78775
Clear the OpenSSL error queue before performing SSL stream operations.
As we don't control all code that could possibly be using OpenSSL,
we can't rely on the error queue being empty.
2019-11-05 12:13:46 +01:00
Nikita Popov
c9abfaec6b Fixed bug #78774
The string held by the zend_type may be released if the property
type gets resolved to a CE. I initially wanted to fix this by
storing a zend_type* instead (so the property type resolution
propagates to the ReflectionType), but decided against this in
light of upcoming union types support, where we also need to
represent parts of the union, and will not have a single zend_type*
we can reference.
2019-11-04 11:04:02 +01:00
Nikita Popov
944c1cf034 Fixed bug #78768
Remove the typedef from zend_types.h, use explicit struct prefix
instead.
2019-11-01 17:04:15 +01:00
Nikita Popov
333d607d47 Fix bug #77930: Remove mmap limit
First, the limitation already doesn't trigger if you copy the whole
file (i.e. use copy() or stream_copy_to_stream() and don't specify
a length). This happens because length will be 0 at the time of the
check and only later calculated based on the file size. This means
that we're already completely blowing the length limit for what is
likely the most common case, and it doesn't seem like anyone complained
about that.

Second, the premise of the code comment ("to avoid runaway swapping")
seems incorrect to me. Because this performs a file-backed non-private
mmap, no swap backing is needed for the mapping. Concerns over "memory
usage" are also misplaced, as this is a virtual mapping.
2019-10-31 09:37:05 +01:00
Christoph M. Becker
0055f1e3dc Fix #78761: Zend memory heap corruption with preload and casting
We have to reset `FFI_G(persistent)` back to zero when preloading has
finished.
2019-10-30 19:49:39 +01:00
Christoph M. Becker
1e2d3d58a8 Fix #78762: Failing FFI::cast() may leak memory
We have to release objects when we're done with them.
2019-10-30 17:21:58 +01:00
Nikita Popov
33dd25d21c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78689
2019-10-29 15:06:52 +01:00
Nikita Popov
f9895b4bf5 Fixed bug #78689 2019-10-29 15:06:16 +01:00
Derick Rethans
365a45210b Update NEWS for 7.4.0RC6 2019-10-29 08:50:32 +00:00
Derick Rethans
6d8168f1d1 Update NEWS for PHP 7.4.0RC5 2019-10-29 08:49:13 +00:00
Christoph M. Becker
bedbecf56d Implement #78270: Support __vectorcall convention with FFI
To work around the limitation of the current rudimentary vectorcall
support in our patched libffi, we forbid yet unsupported declarations,
i.e. float/double parameters at certain positions (SIMD vector types
and HVA types are not supported anyway).
2019-10-29 08:57:43 +01:00
Simonov Denis
3fb42a382c Add support for Interbase 1 dialect 2019-10-28 16:40:51 +01:00
Christoph M. Becker
9e4c5db733 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78751: Serialising DatePeriod converts DateTimeImmutable
2019-10-28 13:09:24 +01:00
Christoph M. Becker
736cd93ef5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78751: Serialising DatePeriod converts DateTimeImmutable
2019-10-28 13:08:34 +01:00
Christoph M. Becker
89c327f884 Fix #78751: Serialising DatePeriod converts DateTimeImmutable
When getting the properties of a DatePeriod instance we have to retain
the proper classes, and when restoring a DatePeriod instance we have to
cater to DateTimeImmutable instances as well.
2019-10-28 13:07:28 +01:00
Nikita Popov
b61b60d15b Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78752
2019-10-28 10:28:04 +01:00
Nikita Popov
16c4910876 Fix bug #78752
NULL out the execute_data before destroying it, otherwise GC may
trigger while the execute_data is partially destroyed, resulting
in double-frees.

The handling of call stack unfreezing is a bit awkward because it's
a ZEND_API function, so we can't change the signature.
2019-10-28 10:27:32 +01:00
Nikita Popov
f1848a4b3f Fix bug #78226: Don't call __set() on uninitialized typed properties
Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are still triggered if
the property is explicitly unset().

This gives us both the behavior people generally expect, and still
allows ORMs to do lazy initialization by unsetting properties.

For PHP 8, we should fine a way to forbid unsetting of declared
properties entirely, and provide a different way to achieve lazy
initialization.
2019-10-25 16:31:45 +02:00
Nikita Popov
74699533e5 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #78747
2019-10-25 12:50:12 +02:00
Nikita Popov
5249993814 Fixed bug #78747 2019-10-25 12:47:18 +02:00
Christoph M. Becker
1c9bfcb6a7 Fix #78716: Function name mangling is wrong for some parameter types
We have to cater to function parameter alignment when calculating the
parameter size.
2019-10-22 11:38:58 +02:00
Christoph M. Becker
c9df44cab4 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Update NEWS
2019-10-22 09:52:08 +02:00
Christoph M. Becker
36943dfff1 Update NEWS 2019-10-22 09:50:11 +02:00
Remi Collet
2213bd36fd add NEWS entry 2019-10-22 09:37:35 +02:00
Dmitry Stogov
05c5e5dfde Fixed bug #78512 (Cannot make preload work) 2019-10-21 14:52:26 +03:00
Joe Watkins
1ac961bea8
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #78697: inaccurate error message
2019-10-21 09:24:41 +02:00
Joe Watkins
1c9b62fbd4
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #78697: inaccurate error message
2019-10-21 09:23:26 +02:00
Fabien Villepinte
bea2ff88c9
Fix bug #78697: inaccurate error message 2019-10-21 09:22:09 +02:00
Jakub Zelenka
666fb9a194 Add NEWS for the fixed bug #74083 2019-10-20 16:58:13 +01:00
Christoph M. Becker
26635ed71a Fix #78684: PCRE bug72463_2 test is sending emails on Linux
This test is not supposed to run on non Windows systems; otherwise it
would try to send an email.
2019-10-19 12:59:32 +02:00
Christoph M. Becker
ee6a71ca73 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:51:05 +02:00
Christoph M. Becker
ce035dc4a0 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78694: Appending to a variant array causes segfault
2019-10-19 11:49:18 +02:00
Christoph M. Becker
45a7723267 Fix #78694: Appending to a variant array causes segfault
`write_dimension` object handlers have to be able to handle `NULL`
`offset`s; for now we simply throw an exception instead of following
the `NULL` pointer.
2019-10-19 11:47:00 +02:00
Christoph M. Becker
197568d634 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70153 \DateInterval incorrectly unserialized
2019-10-18 15:33:25 +02:00
Christoph M. Becker
c7c7ab53ac Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #70153 \DateInterval incorrectly unserialized
2019-10-18 15:32:08 +02:00
m.yakunin
d2cde0bfd3 Fix #70153 \DateInterval incorrectly unserialized
Added a separate macro for reading 'days' property, so that bool(false)
is correctly converted to the proper internal representation.
2019-10-18 15:31:14 +02:00
Derick Rethans
6e2635d2f2 Update NEWS for 7.4.0RC5 2019-10-15 11:29:33 +00:00
Derick Rethans
998be7752c Update NEWS for PHP 7.4.0RC4 2019-10-15 11:28:15 +00:00
Joe Watkins
042e3b227e
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix checksum calculation for opcache
2019-10-14 16:50:23 +02:00
Joe Watkins
22ac57b064
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix checksum calculation for opcache
2019-10-14 16:49:48 +02:00
Mitch Hagstrand
e2a6bf482f
Fix checksum calculation for opcache 2019-10-14 16:46:42 +02:00
Christoph M. Becker
586f8515d5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78665: Multicasting may leak memory
2019-10-12 14:46:10 +02:00
Christoph M. Becker
7439d48bea Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78665: Multicasting may leak memory
2019-10-12 14:44:55 +02:00
Christoph M. Becker
900bdcbd03 Fix #78665: Multicasting may leak memory 2019-10-12 14:43:43 +02:00
Remi Collet
a78b09c9b8 NEWS 2019-10-11 13:38:15 +02:00
Christoph M. Becker
973617cacd Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78656: Parse errors classified as highest log-level
2019-10-09 17:29:54 +02:00
Christoph M. Becker
bbd481c11d Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78656: Parse errors classified as highest log-level
2019-10-09 17:28:50 +02:00