Commit Graph

120247 Commits

Author SHA1 Message Date
Tyson Andre
45d69fb809 Support NO_COLOR environment variable in run-tests.php
And add a --color option for run-tests.php

See https://no-color.org/

> an informal standard is hereby proposed:
>
> All command-line software which outputs text with ANSI color added should check
> for the presence of a `NO_COLOR` environment variable that, when present
> (regardless of its value), prevents the addition of ANSI color.
2020-08-12 09:37:45 -04:00
Nikita Popov
b480e6841e Recognize gnu-libiconv location on alpine 2020-08-12 15:32:11 +02:00
David Carlier
6ca6e9f891 Fix crypt_r detection under BSD system
For BSD systems, crypt.h does not exist, instead we need to
include unistd.h.

Closes GH-5971.
2020-08-12 15:09:21 +02:00
Nyholm
3485ec40ce Small CS fix
The comments were incorrectly aligned. Fix this by dropping the
alignment and moving the comments before the declarations.

Closes GH-5975.
2020-08-12 12:16:53 +02:00
Nikita Popov
824541d57e Disable report_zend_debug by default
We might just want to drop this completely, but at least don't
enable it by default. It already gets disabled by a number of
SAPIs, but we should make that the default state.
2020-08-12 10:36:40 +02:00
Tyson Andre
1e9a5c67ef Rename standard array function parameters to $array
This is targeting 8.0.

`$arg` seems like a poor choice of a name,
especially if the function were to have arguments added.

In many cases, the php.net documentation already has $array for these functions.
E.g. https://www.php.net/manual/en/function.array-intersect.php

I'd assume that since named arguments was added to 8.0 near the feature freeze,
PHP's maintainers had planned to make the names consistent
and gradually use the same name for  docs and implementation.
2020-08-11 19:11:59 -04:00
Ilija Tovilo
10f660f0a5
Fix ?-> in encaps vars without braces
Closes GH-5966.
2020-08-11 21:16:44 +02:00
Nikita Popov
898bb97706 Drop php_pdo_get_exception_base() function
This API is more confusing than helpful.
2020-08-11 17:40:39 +02:00
Nikita Popov
33028bf014 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
2020-08-11 17:16:38 +02:00
Nikita Popov
981af26d7b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #64705 errorInfo property of PDOException is null when PDO::__construct() fails
2020-08-11 17:13:28 +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
Nikita Popov
8694eb14f4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #75785 by attempt switching endianness on Maker's Note
2020-08-11 16:29:01 +02:00
Nikita Popov
5c5508698d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #75785 by attempt switching endianness on Maker's Note
2020-08-11 16:27:06 +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
Nikita Popov
e25aab6426 Fixed bug #79927
We need to unset the AT_FIRST_YIELD flag when yielding from an
array as well.

In the interest of being conservative, I'm applying this only to
PHP 8.
2020-08-11 15:48:40 +02:00
Nikita Popov
227f1f1481 Fix nullsafe operator on $this 2020-08-11 15:22:14 +02:00
Nikita Popov
42eda5160d SAVE_OPLINE in NULL_HANDLER
Let's avoid crashing before the nice error message gets printed...
2020-08-11 15:14:50 +02:00
Nikita Popov
f491dabe40 Fix nullsafe operator on reference
Dereference the value before checking the type. As the happy path
necessarily has to check for references, I'm not bothering to
delay the comparison.
2020-08-11 15:11:36 +02:00
Nikita Popov
75baa729f5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79917
2020-08-11 14:59:04 +02:00
Nikita Popov
4609ded082 Fixed bug #79917
op_arrays can be shared on two levels: Either the op_array is
completely shared, or it is distinct but shares all members
(apart from static_variables).

The the op_array is distinct, we need to make sure to properly
initialize the MAP_PTR structures.
2020-08-11 14:58:54 +02:00
Christoph M. Becker
9e930907df Autogenerate function entries for COMPersistHelper
Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2020-08-11 11:42:40 +02:00
Christoph M. Becker
dc5077cc53 Remove practically unused parameter
The `cached` out parameter of `php_com_load_typelib_via_cache()` was
meant to signal whether a particular typelib actually has been cached.
This is not really relevant, though, for the imagined purposes, and
since the parameter is no longer really used, we removed it altohether.
2020-08-11 11:38:43 +02:00
Christoph M. Becker
013dcab344 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #48585: com_load_typelib holds reference, fails on second call
2020-08-11 11:28:41 +02:00
Christoph M. Becker
183b853dc6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #48585: com_load_typelib holds reference, fails on second call
2020-08-11 11:28:07 +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
dd858460bb Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79951
2020-08-11 10:35:59 +02:00
Nikita Popov
66d9f4d985 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #79951
2020-08-11 10:35:25 +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
Máté Kocsis
56135654a0
Remove unnecessary function entry array 2020-08-11 09:41:54 +02:00
George Wang
e05439e7a4 Merge branch 'PHP-7.4' 2020-08-10 19:11:48 -04:00
George Wang
1b0a2bb0f5 Merge branch 'PHP-7.3' into PHP-7.4 2020-08-10 19:11:26 -04:00
George Wang
07cb2755be Make sure string is NUL byte terminated. 2020-08-10 19:11:03 -04:00
Christoph M. Becker
2538e31b58 Fix signature of callback function
Cf. <https://docs.microsoft.com/en-us/windows/win32/api/imagehlp/nc-imagehlp-pimagehlp_status_routine>.
2020-08-10 23:26:54 +02:00
Nikita Popov
7e87173497 Merge branch 'PHP-7.4'
* PHP-7.4:
  Check the correct list
2020-08-10 21:53:26 +02:00
Nikita Popov
81e31eff0b Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Check the correct list
2020-08-10 21:53:20 +02:00
Nikita Popov
4723bd4ffa Check the correct list
This was supposed to check mx_list, not weight_list... oops.
2020-08-10 21:52:36 +02:00
Nikita Popov
59fbdf7326 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79944
2020-08-10 20:43:24 +02:00
Nikita Popov
5b8b480d23 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix bug #79944
2020-08-10 20:43:13 +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
Nikita Popov
657707a105 Skip bug70417.phpt if lsof output looks wrong
On alpine lsof accepts -p but it doesn't actually do anything.
Add a crude check for whether lsof looks like Linux lsof.
2020-08-10 15:59:08 +02:00
Nikita Popov
217d05b18e Check permissions in pcntl_unshare_03.phpt 2020-08-10 15:59:02 +02:00
Nikita Popov
dad25538f6 Don't check specific message in socket_shutdown.phpt 2020-08-10 15:58:54 +02:00
Nikita Popov
e4f5190942 Only test one error in socket_strerror() test
The messages differ by used libc and version, so let's not try to
do exhaustive testing here.
2020-08-10 15:58:38 +02:00
Nikita Popov
c439f1fa6a Fixed bug #62294
The primary issue was already resolved in 7c3e487289,
but the particular example used in this bug report ran into an
additional issue on PHP 8, because I forgot to drop a number of
zend_bailout calls when switch require failure to throw.
2020-08-10 12:54:02 +02:00
Nikita Popov
7c3e487289 Fixed bug #65275
Make EG(exit_status) the single source of truth for the exit status,
instead of having two variables that we cannot really keep
synchronized.
2020-08-10 12:40:26 +02:00
Christoph M. Becker
4c1a490be5 Merge branch 'PHP-7.4' into master
* PHP-7.4:
  Fix #79922: Crash after multiple calls to xml_parser_free()
2020-08-10 12:27:33 +02:00
Christoph M. Becker
2830c3ef52 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79922: Crash after multiple calls to xml_parser_free()
2020-08-10 12:25:26 +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
Nikita Popov
90a2c79be0 Remove some unnnecessary null checks in openssl
Remove null checks before EVP_PKEY_free and BIO_free. NULL is a
no-op for both of these. Probably applies to most other freeing
function as well...
2020-08-10 12:10:30 +02:00
Nikita Popov
80d3ce3d19 Improve X509_PKEY management in OpenSSL
Remove the free_pkey argument from php_openssl_pkey_from_zval,
instead return an EVP_PKEY that always needs to be freed
(by incrementing refcount if necessary).

This makes the code simpler and fixes a number of bugs in the
existing handling.

Closes GH-5946.
2020-08-10 11:43:49 +02:00