Nikita Popov [Mon, 6 Jan 2020 11:06:51 +0000 (12:06 +0100)]
Allow variadic arguments to replace non-variadic ones
Any number of arguments can be replaced by a variadic one, so
long as the variadic argument is compatible (in the sense of
contravariance) with the subsumed arguments.
In particular this means that function(...$args) becomes a
near-universal signature: It is compatible with any function
signature that does not accept parameters by-reference.
This also fixes bug #70839, which describes a special case.
Apply custom format/length modifier removal to spprintf
This mimicks the changes made to the custom snprintf implementation
by removing the custom 'v' format and custom 'I' length modifier
from the spprintf implementation.
Make MSVCRT memory leak checking usable for the test suite
While basic support for MSVCRT debugging has been added long
ago[1], the leak checking is not usable for the test suite, because we
are no longer calling `xmlCleanupParser()` on RSHUTDOWN of
ext/libxml[2], and therefore a few bogus leaks are reported whenever
ext/libxml is unloaded.
We therefore ignore memory leaks for this case. We introduce
`ZEND_IGNORE_LEAKS_BEGIN()` and `ZEND_IGNORE_LEAKS_END()` to keep
those ignores better readable, and also because these *might* be
useful for other leak checkers as well.
We also explicitly free the `zend_handlers_table` and the `p5s` to
avoid spurious leak reports.
Tyson Andre [Mon, 20 Jan 2020 21:53:37 +0000 (16:53 -0500)]
Use smaller batch size in run-tests.php when appropriate
- When valgrind is used, communication overhead is relatively small,
so just use a batch size of 1.
- If this is running a small enough number of tests,
reduce the batch size to give batches to more workers.
(Previously, if there were 90 tests and -j8,
only 3 of 8 workers would get a batch of size 32 or less.
After this change, the batch size is 12 or less)
Tyson Andre [Mon, 20 Jan 2020 22:00:56 +0000 (17:00 -0500)]
Don't start unnecessary processes with run-tests.php -j
If there's only 2 files to test, then only start 2 workers instead of N.
If there's only 1 file, then avoid parallelism entirely.
A separate option such as `--force-parallel` could be added
if this turns out to be something developers would want to do
when debugging test failures.
Deus Kane [Mon, 20 Jan 2020 16:16:01 +0000 (16:16 +0000)]
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".
Tyson Andre [Sun, 19 Jan 2020 18:44:13 +0000 (13:44 -0500)]
Speed up unserializing object properties
Hash table lookups are slow.
Don't do one a second time to update the property.
The call to zend_hash_update_ind goes back to 8b0deb8cd2d
Background: Properties are IS_INDIRECT when they're a declared property,
and point to properties_table.
See https://nikic.github.io/2015/06/19/Internal-value-representation-in-PHP-7-part-2.html#objects-in-php-7
Nikita Popov [Mon, 20 Jan 2020 09:34:17 +0000 (10:34 +0100)]
Eliminate uses of ZVAL_ZVAL and friends
Instead add RETURN_COPY(_VALUE) macros will the expected behavior.
RETURN_ZVAL doesn't make any sense since PHP 7, but has stuck
around, probably because the alternative was to write directly to
the return_value variable.
Nikita Popov [Fri, 17 Jan 2020 10:22:32 +0000 (11:22 +0100)]
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.
libcurl 7.29.0 has been released almost eight years ago, so this
version is supposed to be available practically everywhere. This bump
also allows us to get rid of quite some conditional code and tests
catering to very old libcurl versions.
Attempting to require a file with (unset) casts results in an E_COMPILE_ERROR
that can't be caught or handled by set_exception_handler/set_error_handler.
Also remove the (bool) cast, because the ZEND_BOOL opcode handles that.
Remove inference that array -> object cast can throw.
It was added in 2a286ad5991 - I don't know how creating an stdClass would throw.
(numeric keys, references, etc. don't cause it to throw)