Commit Graph

12007 Commits

Author SHA1 Message Date
Christoph M. Becker
4000780b3d Fix #79423: copy command is limited to size of file it can copy
Passing `NULL` as `lpFileSizeHigh` to `GetFileSize()` gives wrong
results for files larger than 0xFFFFFFFF bytes.  We fix this by using
`GetFileSizeEx()`, and let the mapping fail, if the file size is too
large for the architecture.

Closes GH-5319.
2020-09-22 13:15:07 +02:00
Christoph M. Becker
81b2f3e5d9 Fix #80114: parse_url does not accept URLs with port 0
URIs with a 0 port are generally valid, so `parse_url()` should
recognize such URIs, but still report the port as missing.

Co-authored-by: twosee <twose@qq.com>

Closes GH-6152.
2020-09-20 15:34:45 +02:00
Nikita Popov
ecd9c42f9e Fix bug #80107: Handling of large compressed packets
There's two layers of packet splitting going on. First, packets
need to be split into having a payload of exactly 2^24-1 bytes or
being the last packet. If the split packet has size between 2^24-5
and 2^24-1 bytes, the compressed packets also needs to be split,
though the choice of split doesn't matter here. I'm splitting off
the first 8192 bytes, as that's what I observe libmysqlclient to be
doing.
2020-09-18 12:55:44 +02:00
Christoph M. Becker
efdbc3688b Fix #80115: mysqlnd.debug doesn't recognize absolute paths with slashes 2020-09-17 12:37:02 +02:00
Nikita Popov
a4f806aa79 Fixed bug #80083
Add db2_execute() to the list of functions accessing the local
scope. Ideally the API wouldn't do that, but it seems most
pragmatic to address this on the opcache side at this point.
2020-09-17 10:12:10 +02:00
Christoph M. Becker
edddddcea8 7.3.24 is next 2020-09-15 10:51:41 +02:00
Christoph M. Becker
dfb3a79914 Fix #80067: Omitting the port in bindto setting errors
A recent commit[1] which fixed a memory leak introduced a regression
regarding the formerly liberal handling of IP addresses to bind to.  We
fix this by reverting that commit, and fix the memory leak where it
actually occurs.  In other words, this fix is less intrusive than the
former fix.

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

Closes GH-6104.
2020-09-11 14:44:12 +02:00
Sammy Kaye Powers
2d4aa1ef3d
Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
Modules may have changed after restart which can cause dangling pointers from custom opcode handlers in the second-level cache files. This fix includes the installed module names and versions in the accel_system_id hash as entropy. Closes GH-5836
2020-09-09 12:08:19 -07:00
Christoph M. Becker
5dcb8f2f1c Fix #72941: Modifying bucket->data by-ref has no effect any longer
To match the PHP 5 behavior, we have to explicitly cater to `buffer` or
`data` being references.

Closes GH-6096.
2020-09-08 18:06:40 +02:00
Nikita Popov
07cb665515 Fixed bug #80077
Quoting from the bug report:

> The domain names passed to getmxrr() do not contain a trailing dot.
> DNS lookups which do not find records will (depending on the local
> resolver config) try again by adding the local domain to the end of
> the searched host/domain. In many environments there's an mx record
> for any subdomain of the local domain and the MX query will return
> a hit. But the test expects no hit. So the test fails when checking
> that "qa.php.net" does not have an MX record in DNS. In our local
> environment the resolver falls back to also check qa.php.net.kippdata.de
> which does have an MX record. Using "qa.php.net." instead of "qa.php.net"
> should fix this for everyone.
2020-09-08 10:00:49 +02:00
Nikita Popov
46a49be6c8 Fixed bug #80049
Type checking may convert to refcounted values, so force freeing
of extra args.
2020-09-03 17:12:40 +02:00
Christoph M. Becker
1848ccdae2 Fix #80048: Bug #69100 has not been fixed for Windows
We fix the erroneous length calculation on Windows, too.

Closes GH-6067.
2020-09-03 15:43:19 +02:00
Matteo Beccati
44ade0e875 Fix #80027 Terrible performance using $query->fetch on queries with many bind parameters
Added new flags that allow skipping param_evt(s) that are not used by drivers,
in a backwards and forward compatible manner. Updated the pgsql, mysql, sqlite
and oci drivers to properly use the new flags. I've left out pdo_dblib, which
doesn't have a param_hook, and pdo_firebird, which seems to be using
PARAM_EVT_NORMALIZE in a wrong context (param type vs event type).
2020-08-31 11:03:03 +02:00
Christoph M. Becker
5ff15e2651 Fix #64130: COM obj parameters passed by reference are not updated
`ITypeInfo_GetIDsOfNames()` is supposed to fail with `E_NOTIMPL` for
out-of-process servers, thus we should not remove the already available
typeinfo of the object in this case.

We also properly free the `byref_vals`.
2020-08-26 14:50:04 +02:00
Christoph M. Becker
844a2dd6ac Fix #79986: str_ireplace bug with diacritics characters
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).

Closes GH-6007
2020-08-24 11:08:48 +02:00
Christoph M. Becker
fcd26ffcc3 Fix #80002: calc free space for new interned string is wrong
We need to calculate the free size in bytes.

Patch contributed by t-matsuno.

Closes GH-6024
2020-08-24 11:03:19 +02:00
Andy Postnikov
b2a33ab06b Fix #80007: Potential type confusion in unixtojd() parameter parsing
Also it fixes test on 32-bit armv7 and x86
- Test unixtojd() function : error conditions [ext/calendar/tests/unixtojd_error1.phpt]

Closes GH-6033
2020-08-22 12:30:04 +02:00
Matteo Beccati
f7c43b8c72 Fix #47021: SoapClient stumbles over WSDL delivered with "Transfer-Encoding: chunked" 2020-08-18 18:10:39 +02:00
Christoph M. Becker
ff14b7adad 7.3.23 is next 2020-08-18 09:55:37 +02:00
Ahmed Abdou
2fe2e5b48f Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
PDO driver constructors are throwing PdoException without setting
errorInfo, so create a new reusable function that throws exceptions
for PDO and will also set the errorInfo. Use this function in
pdo_mysql, pdo_sqlite, and pdo_pgsql.
2020-08-11 17:12:48 +02:00
Nawarian
2fa4ca95db Fix bug #75785 by attempt switching endianness on Maker's Note
Different manufacturer models may come with a
different endianness (motorola/intel) format. In
order to avoid a big refactor and a gigantic lookup
table, this commit simply attempts to switch the
endianness and proceed when values are acceptable.

Closes GH-5849.
2020-08-11 16:26:34 +02:00
Christoph M. Becker
dc108feab8 Fix #48585: com_load_typelib holds reference, fails on second call
Whether the type library is cached is actually irrelevant here; what
matters is that the symbols are imported, and since these are not
cached, we have to import them for every request.  And we cannot cache
the symbols, because the import depends on the current codepage, but
the codepage is a `PHP_INI_ALL` setting.
2020-08-11 11:26:50 +02:00
Nikita Popov
9d9dffe60a Fixed bug #79951
One branch did not release tmp_replace_entry_str.

Also reduce the scope of some variables.
2020-08-11 10:33:59 +02:00
Nikita Popov
a06eed0c0e Fix bug #79944
Only return true from dns_get_mx if we actually found any MX record.
2020-08-10 20:42:50 +02:00
Christoph M. Becker
0af3f49312 Fix #79922: Crash after multiple calls to xml_parser_free()
We must not call `zend_list_delete()` in resource closer functions
exposed to userland, because decreasing the refcount there leads to
use-after-free scenarios.  In this case, commit 4a42fbb worked for
typical use-cases where `xml_parser_free()` has been called exactly
once for the resource, because there is an internal zval (`->index`)
referencing the same resource which already increased the refcount by
one.  However, when `xml_parser_free()` is called multiple times on the
same XML parser resource, the resource would be freed prematurely.

Instead we forcefully close the resource in `xml_parser_free()`.  We
also could decrease the refcount of the resource there, but that would
require to call `xml_parser_free()` which is somewhat uncommon, and
would be particularly bad wrt. PHP 8 where that function is a NOP, and
as such doesn't have to be called.  So we do no longer increase the
refcount of the resource when copying it to the internal zval, and let
the usualy refcounting semantics take care of the resource destruction.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=4a42fbbbc73aad7427aef5c89974d1833636e082>
2020-08-10 12:23:44 +02:00
Florian Engelhardt
5be670265b Fix bug #70574: Move files to proper locale dir
Closes GH-5940.
2020-08-07 14:37:27 +02:00
Pieter van den Ham
06ade15528 Fix #79934: CRLF-only line in heredoc causes parsing error
Fixes the function `next_newline()` in zend_language_scanner.l. The
function now correctly returns a newline_len of 2 for "\r\n".

Closes GH-5944.
2020-08-06 12:02:54 +02:00
Nikita Popov
da786a22af Fixed bug #79930
We're inserting src_zval, so that's what we should addref.
2020-08-05 15:43:41 +02:00
Christoph M. Becker
c4677af67e [ci skip] Fix 7.3.21 release date 2020-08-04 12:31:24 +02:00
Christoph M. Becker
17d64af186 [ci skip] Add missing NEWS entries 2020-08-03 11:18:18 +02:00
Christoph M. Becker
1e0bc6e30f Fix #79919: Stack use-after-scope in define()
Instead of the temporary `rv`, we use the `val_free` which is there for
this purpose.
2020-07-31 10:54:41 +02:00
Santiago M. Mola
e767ca60a0 Fix #79895: support = in PHP_CHECK_GCC_ARG m4 macro
Closes GH-5890.
2020-07-29 12:36:52 +02:00
Christoph M. Becker
9a744c66e7 Fix #73060: php failed with error after temp folder cleaned up
Instead of storing the mapping base address and the address of
`execute_ex()` in a separate file in the temporary folder, we store
them right at the beginning of the memory mapping.
2020-07-29 10:07:23 +02:00
Christoph M. Becker
c756f82c02 Fix #79806: realpath() erroneously resolves link to link
After resolving reparse points, the path still may be a reparse point;
in that case we have to resolve that reparse point as well.
2020-07-28 13:55:22 +02:00
Paweł Tomulik
efe6d96b45 fix memory leaks in ext/ldap/ldap.c 2020-07-28 10:23:10 +02:00
Christoph M. Becker
1aeff522b8 Revert "Fix #79806: realpath() erroneously resolves link to link"
This reverts commit d5b59b4303.
2020-07-27 17:50:41 +02:00
Christoph M. Becker
d5b59b4303 Fix #79806: realpath() erroneously resolves link to link
After resolving reparse points, the path still may be a reparse point;
in that case we have to resolve that reparse point as well.
2020-07-27 15:08:39 +02:00
Christoph M. Becker
6f18d7e2f9 Fix #77932: File extensions are case-sensitive
The file extension to mime type mapping *must* not depend on the file
extension's case for case-insensitive file systems, and *should* not
for case-sensitive file systems.
2020-07-27 11:52:18 +02:00
Christoph M. Becker
15efb96d4c Fix #79884: PHP_CONFIG_FILE_PATH is meaningless
It does not make sense to make assumptions about `PHP_CONFIG_FILE_PATH`
during build time, since that value is never used during run time on
Windows.  Since there is no `--with-config-file-path` on Windows
either, we define `PHP_CONFIG_FILE_PATH` as `""`.
2020-07-23 15:39:22 +02:00
Christoph M. Becker
2c0a6977dd 7.3 is now 7.3.22-dev 2020-07-21 09:18:07 +02:00
Christoph M. Becker
b2e3fd1e69 Fix #63527: DCOM does not work with Username, Password parameter
We must not mix multibyte and wide character strings in the
`COAUTHIDENTITY` structure.  Using wide character strings throughout
would have the advantage that the remote connection can be established
regardless of the code page of the server, but that would more likely
break BC, so we just drop the wide character string conversion of the
username.
2020-07-20 14:43:29 +02:00
Andy Postnikov
2c57378bd3 Fix bug #78008: dns_check_record() always return true on Alpine
- free handle before return result
- cleaned up remaining usage of MAXPACKET
- update dns_get_mx() to use the same approach

Closes GH-5854.
2020-07-15 15:10:19 +02:00
Nikita Popov
a72c53a070 Fixed bug #79817
Use *_IND macros in a few places in string.c.
2020-07-10 14:06:41 +02:00
XXiang
3d5de7d746 Fix bug #79787
Closes GH-5807.
2020-07-08 11:20:58 +02:00
Nikita Popov
64931fd3c4 Fixed bug #79792
We need to remove the iterators even if the array is empty (we
will not create one if the first place, but the array may become
empty after the fact).
2020-07-07 11:58:25 +02:00
Nikita Popov
b765f96f5f Fixed bug #79778
In the interest of avoiding side-effects during dumping, I'm
replacing the value with a <constant ast> string instead of
performing an update constant operation.
2020-07-07 10:19:39 +02:00
Christoph M. Becker
7f3bc64287 Fix #70362: Can't copy() large 'data://' with open_basedir
open_basedir is only relevant for plain files, so there is no need to
check it for other URL wrappers.
2020-06-30 10:46:53 +02:00
Christoph M. Becker
a385cfa7ad Fix #63208: BSTR to PHP string conversion not binary safe
A `BSTR` is similar to a `zend_string`; it stores the length of the
string just before the actual string, and thus the string may contain
NUL bytes.  However, `php_com_olestring_to_string()` is supposed to
deal with arbitrary `OLECHAR*`s which may not be `BSTR`s, so we
introduce `php_com_bstr_to_string()` and use it for the only case where
we actually have to deal with `BSTR`s which may contain NUL bytes.

Contrary to `php_com_olestring_to_string()` we return a `zend_string`,
so we can save the re-allocation when converting to a `zval`.

We also cater to `php_com_string_to_olestring()` not being binary safe,
with basically the same fix we did for `php_com_olestring_to_string()`.
2020-06-29 19:05:02 +02:00
Christoph M. Becker
816b4c1235 Fix #79756: finfo_file crash (FILEINFO_MIME)
If `ctime` or `asctime` return `NULL`, we must not attempt to copy the
buffer, but rather return `NULL` as well.
2020-06-29 17:45:28 +02:00
Nikita Popov
43cd3f6814 Fixed bug #79741 2020-06-26 12:28:39 +02:00