Revert "Remove dead code in libmbfl, memory device"
Stop trusting CLion's automatic dead code detection because it seems to be wrong
more often than not.
This reverts commit 612c86db3ea139e4ed4aa6a9aa28da343c9b39b8.
Nikita Popov [Wed, 11 Dec 2019 16:11:30 +0000 (17:11 +0100)]
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.
Kachalin Alexey [Thu, 12 Dec 2019 10:49:06 +0000 (11:49 +0100)]
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.
Nikita Popov [Thu, 12 Dec 2019 10:19:07 +0000 (11:19 +0100)]
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.
Tyson Andre [Thu, 5 Dec 2019 00:57:14 +0000 (19:57 -0500)]
Add funcinfo for spl global functions
This assumes that `iterator_*` will now always throw or abort on failure.
Also, move #include _arginfo.h directive to the top of the file - virtually all
other files put it there, and developers may base code on basic_functions.c.
Nikita Popov [Wed, 11 Dec 2019 12:06:10 +0000 (13:06 +0100)]
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.
Tyson Andre [Sat, 7 Dec 2019 15:09:32 +0000 (10:09 -0500)]
Speed up array_intersect/array_diff/array_filter
Use zend_hash_update instead of zend_hash_add.
These are taking a subset of keys from an array with unique keys,
so the result should also have unique keys.
(this is already done for array_map())
Also, speed up array_intersect and array_diff slightly by
using ZEND_HASH_FOREACH macros.
This way, it doesn't need to load the same buckets and array counts
from memory every time (compiler previously couldn't infer they won't change)
```php
<?php
// $n=10000 now takes 0.095 seconds instead of 0.102
function test_bench(int $n) {
$values = range(0,1000);
$other = range(0,1000);
unset($other[500]);
unset($values[400]);
Nikita Popov [Tue, 10 Dec 2019 12:49:40 +0000 (13:49 +0100)]
Fix release build failure
GCC complained about potentially uninitialized __orig_bailout,
even though the variable has an initializer. This warning was
quite persistent, I was only able to avoid it by using a separate
function.
Nikita Popov [Mon, 9 Dec 2019 14:14:39 +0000 (15:14 +0100)]
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.
Dmitry Stogov [Mon, 9 Dec 2019 12:07:39 +0000 (15:07 +0300)]
Merge branch 'PHP-7.4'
* PHP-7.4:
Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback. Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
Dmitry Stogov [Mon, 9 Dec 2019 12:05:24 +0000 (15:05 +0300)]
Call zend_unregister_ini_entries() when unload extension loaded through dl() without MSHUTDOWN callback.
Extensions with MSHUTDOWN should use UNREGISTER_INI_ENTRIES().
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.
Nikita Popov [Mon, 9 Dec 2019 08:15:27 +0000 (09:15 +0100)]
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.
Nikita Popov [Mon, 28 Oct 2019 12:34:33 +0000 (13:34 +0100)]
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.
Drop duplicate definitions of zend_isnan and friends
Following up on commit 1c4ad17[1], we remove these definitions from
zend_config.w32.h, since they would be overridden by those in
zend_portability.h anyway.