Commit Graph

50150 Commits

Author SHA1 Message Date
Christoph M. Becker
2be27074b6 Fix #80280: ADD_EXTENSION_DEP() fails for ext/standard and ext/date
`ADD_EXTENSION_DEP()` relies on the `PHP_<extname>` config variables to
be set to `"yes"`, and since the standard and date extension are always
enabled, we define the respective variables uncoditionally.

Closes GH-6383.
2020-10-26 11:03:05 +01:00
George Peter Banyard
12a09183b3 Fix bug 76618
Apply patch which was attached to the bug in July 2018
2020-10-22 17:01:48 +01:00
Nikita Popov
d4bf0799b8 Don't crash on uninitialized tidy object
"Uninitialized" here means that the object was created ordinarily
-- no constructor skipping involved. Most tidy methods seem to
handle this fine, but these three need to be guarded.
2020-10-22 16:04:22 +02:00
Derick Rethans
d4200ba6cf Updated to version 2020.4 (2020d) 2020-10-22 10:12:24 +01:00
Christoph M. Becker
315b95b065 Fix #80242: imap_mail_compose() segfaults for multipart with rfc822
libc-client expects `TYPEMESSAGE` with an explicit subtype of `RFC822`
to have a `nested.msg` (otherwise there will be a segfault during
free), but not to have any `contents.text.data` (this will leak
otherwise).

Closes GH-6345.
2020-10-20 18:58:45 +02:00
Christoph M. Becker
de58fb34c9 Add char* cast to avoid compiler warnings
In libc-client 2007f `data` is declared as `unsigned char *`; there may
be variants which declare it as `void *`, but in any case picky
compilers may warn about a pointer type mismatch in the conditional
(and error with `-W-error`), so we're adding a `char *` cast for good
measure.
2020-10-20 16:29:42 +02:00
Christoph M. Becker
7f3bdda29b Properly fix #80220
The original fix for that bug[1] broke the formerly working composition
of message/rfc822 messages, which results in a segfault when freeing
the message body now.  While `imap_mail_compose()` does not really
support composition of meaningful message/rfc822 messages (although
libc-client appears to support that), some code may still use this to
compose partial messages, and using string manipulation to create the
final message.

The point is that libc-client expects `TYPEMESSAGE` with an explicit
subtype of `RFC822` to have a `nested.msg` (otherwise there will be a
segfault during free), but not to have any `contents.text.data` (this
will leak otherwise).

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

Closes GH-6343.
2020-10-20 13:32:53 +02:00
Derick Rethans
7b5f232b03 Updated to version 2020.3 (2020c) 2020-10-19 09:31:02 +01:00
Christoph M. Becker
4b9db65f68 Fix broken fix for #80239
No idea why that `git am` failed that badly.
2020-10-15 13:18:34 +02:00
Christoph M. Becker
5941b30bb8 Fix #80239: imap_rfc822_write_address() leaks memory
We have to free the address when we're finished with it.
2020-10-15 12:54:53 +02:00
Nikita Popov
a29016d70d Fix leak in gmp_export() 2020-10-15 10:16:22 +02:00
Christoph M. Becker
db8bf0a9e0 Fix #64076: imap_sort() does not return FALSE on failure
If unsupported `$search_criteria` are passed to `imap_sort()`, the
function returns an empty array, but there is also an error on the
libc-client error stack ("Unknown search criterion: UNSUPPORTED
(errflg=2)").  If, on the other hand, unsupported `$criteria` or
unsupported `$flags` are passed, the function returns `false`.  We
solve this inconsistency by returning `false` for unsupported
`$search_criteria` as well.

Closes GH-6332.
2020-10-13 19:37:05 +02:00
Christoph M. Becker
8488c34fc6 Fix #80226: imap_sort() leaks sortpgm memory
We need to free what we have allocated.

Closes GH-6327.
2020-10-12 23:16:31 +02:00
Christoph M. Becker
73e43b6e19 Fix #80216: imap_mail_compose() does not validate types/encodings
We need to check whether the given `type`s and `encoding`s are within
bounds to avoid segfaults and out-of-bound reads.

Closes GH-6323.
2020-10-12 16:27:49 +02:00
Christoph M. Becker
c1962e900a Fix #80223: imap_mail_compose() leaks envelope on malformed bodies
We have to clean up even on failure.

Closes GH-6322.
2020-10-12 15:08:30 +02:00
Christoph M. Becker
0d022ddf03 Fix #80220: imap_mail_compose() may leak memory
Unless `topbod` is of `TYPEMULTIPART`, `mail_free_body()` does not free
the `nested.part`; while we could do this ourselves, instead we just
ignore additional bodies in this case, i.e. we don't attach them in the
first place.

Closes GH-6321.
2020-10-12 13:31:30 +02:00
Derick Rethans
1ed5a2a54d Fixed test for bug #48097 due to confirmed data changes in timelib 2020-10-11 14:53:52 +01:00
Christoph M. Becker
62a2387a8d Fix #80215: imap_mail_compose() may modify by-val parameters
We separate the input arrays and all sub-arrays to avoid modification
of the passed parameters.

This should be rewritten to use `zend_string`s for the "master" branch.

Closes GH-6316.
2020-10-10 23:25:06 +02:00
Christoph M. Becker
8bee0fbd37 Fix #80213: imap_mail_compose() segfaults on certain $bodies
We have to cater to non-associative arrays where the key may be `NULL`;
we just skip these elements.

Closes GH-6315.
2020-10-10 19:17:13 +02:00
Petr Sumbera
07a4185df1 Make iconv errno support test pass on Solaris.
Closes GH-6291.
2020-10-09 15:24:36 +02:00
Nikita Popov
5018581410 XFAIL test broken by timelib update
I was expecting this to get fixed quickly, but it didn't.
XFAIL for now.
2020-10-09 14:04:47 +02:00
Derick Rethans
14d231bd16 Updated to version 2020.2 (2020b) 2020-10-08 15:19:46 +01:00
Derick Rethans
90a5d7c2ad Updated to version 2020.2 (2020b) 2020-10-08 15:05:38 +01:00
Christoph M. Becker
1895bf7b94 Fix too strict imap test expectations 2020-10-08 12:06:54 +02:00
Christoph M. Becker
e68acd031d Fix #77040: tidyNode::isHtml() is completely broken
The documentation of `tidyNode::isHtml()` states that this method
"checks if a node is part of a HTML document".  That is, of course,
nonsense, since a tidyNode is "an HTML node in an HTML file, as
detected by tidy."

What this method is actually supposed to do is to check whether a node
is an element (unless it is the root element).  This has been broken by
commit d8eeb8e[1], which assumed that `enum TidyNodeType` would
represent flags of a bitmask, what it does not.

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

Closes GH-6290.
2020-10-07 17:43:56 +02:00
Christoph M. Becker
e857dfa7cc Fix #80185: jdtounix() fails after 2037
There is no such thing as the "end of the unix epoch", and if it was,
it would certainly not be 2037-10-11T02:00:00.  There is, however,
potential integer overflow which we need to avoid.

Closes GH-6288.
2020-10-07 13:23:50 +02:00
Christoph M. Becker
69ba81d183 Fix #46050: odbc_next_result corrupts prepared resource
When resetting the result's values, we also have to reset its numcols.
2020-10-05 17:46:37 +02:00
Nikita Popov
aa405b7da2 Fix -Wimplicit-function-declaration in configure
As this is an error with xcode 12, see bug #80171.
2020-10-05 10:43:58 +02:00
K.Kosako
bf6873a18e Fix out-of-bounds write
Fixes CVE-2020-26159.

Backported from <cbe9f8bd9c>.
2020-10-02 15:02:35 +02:00
George Peter Banyard
1616363850 Fixed incorrect error message 2020-09-30 08:37:16 +03:00
George Peter Banyard
3f5c47af3b Fixed incorrect logical condition 2020-09-30 08:29:00 +03:00
Christoph M. Becker
bf5f07cc8b Fix #80152: odbc_execute() moves internal pointer of $params
As least intrusive fix, we separate the passed array argument.

Closes GH-6219.
2020-09-29 11:34:48 +02:00
Christoph M. Becker
df5efa2fcd Fix #80150: Failure to fetch error message
In case of statement related errors, we need to pass the respective
statement handle to `SQLError()`.

Closes GH-6217.
2020-09-29 11:02:51 +02:00
Matthias Karbe
f5afd0a827 Fix bug #80137
Skip getprotobyname() and getprotobynumber() tests on *nix if there
is no /etc/protocols file.

Closes GH-6193.
2020-09-29 10:58:00 +02:00
Matthias Karbe
2899137391 Fix bug #80138
Skip getservbyname() and getservbyport() tests on *nix if there is
no /etc/services file.

Closes GH-6191.
2020-09-29 10:57:20 +02:00
Stanislav Malyshev
2f5cb702ff Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV) 2020-09-28 21:43:11 -07:00
Christoph M. Becker
6acfb79276 Fix #67465: NULL Pointer dereference in odbc_handle_preparer
We have to initialize `stmt->driver_data` before we use it.

Closes GH-6225.
2020-09-28 22:57:01 +02:00
George Peter Banyard
4dfbf07644 Fix logic error in PDO 2020-09-25 16:28:48 +01:00
Christoph M. Becker
a49555a9e1 Fix #80147: BINARY strings may not be properly zero-terminated
We have to manually ensure that all strings fetched from a data source
are zero-terminated.

Closes GH-6213.
2020-09-25 13:51:18 +02:00
Christoph M. Becker
e74f89d95a Use proper skipif section
The ODBC tests have to be skipped if no connection to the server can be
established.
2020-09-24 17:12:18 +02:00
Christoph M. Becker
610e7d2c77 Fix #78470: odbc_specialcolumns() no longer accepts $nullable
It is mandatory to pass either `SQL_NO_NULLS` or `SQL_NULLABLE` as
tenth parameter to `SQLSpecialColumns()`; otherwise the function call
fails.  Therefore the user must be allowed to pass the desired value
as parameter to `odbc_specialcolumns()` again.

Closes GH-6200.
2020-09-24 12:15:59 +02:00
Christoph M. Becker
2576c57a51 Fix #76735: Incorrect message in fopen on invalid mode
We have to log errors in `stream_opener` callbacks to the wrapper's
error log, because otherwise we may pick up an unrelated `errno` or a
most generic message.

Closes GH-6187.
2020-09-23 10:54:06 +02:00
Christoph M. Becker
9439d65f0d Fix #77493: curl_basic_009 fails with newer curl versions
libcurl 7.62.0 introduced a maximum protocol length of 8, so this test
case failed with `CURLE_URL_MALFORMAT`.  While this is lifted to 40 as
of libcurl 7.65.0, and this test case has already been fixed with
commit e27301c[1], we restore the original intention to check for a
`CURLE_UNSUPPORTED_PROTOCOL ` error.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=e27301c7b37f6a1643a0dc1966919bd62a32bc74>
2020-09-23 10:42:48 +02:00
Christoph M. Becker
5ed0602ec6 Fix #76943: Inconsistent stream_wrapper_restore() errors
If restoring of any not registered built-in wrapper is requested, the
function is supposed to fail with a warning, so we have to check this
condition first.

Furthermore, to be able to detect whether a built-in wrapper has been
changed, it is not sufficient to check whether *any* userland wrapper
has been registered, but rather whether the specific wrapper has been
modified.

Closes GH-6183.
2020-09-22 16:11:35 +02:00
Christoph M. Becker
730fdc77a7 Fix memory leak in php_imap_mutf7()
We have to free the string which has been allocated by libc-client.
2020-09-21 11:25:46 +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
Bob Weinand
a7544411df Fix mysqli build with mysqlnd and without PDO 2020-09-20 10:02:09 +02:00
Daniel Black
740f0f6165 Fix #78179: mysqli/mysqlnd transaction extensions
MariaDB versioning created a mess with regarding testing
features based on version. We sidestep the problem here
by assuming the extensions are present, and if a syntax
error occurs with a SQL mode TRANS_START_READ_WRITE |
TRANS_START_READ_ONLY enabled, then output the same
warning as before.
2020-09-18 15:29:44 +02:00
Nikita Popov
70cba36fc9 Support NO_BACKSLASH_ESCAPES with newer libmysqlclient
Requires the use of mysql_real_escape_string_quote().
2020-09-18 15:24:57 +02:00
Nikita Popov
77f43e48ff Use MyISAM engine for new test
Travis on 7.3 is showing this error:

> The size of BLOB/TEXT data inserted in one transaction is greater
> than 10% of redo log size. Increase the redo log size using
> innodb_log_file_size.

Force MyISAM engine to avoid this.
2020-09-18 14:49:43 +02:00