Alex Dowad [Wed, 15 Apr 2020 13:25:14 +0000 (15:25 +0200)]
Fix bug #67369 ArrayObject serializatino drops the iterator class
When ArrayObject is round-tripped through serialize() and unserialize(),
it forgets any iterator class name which was set using ::setIteratorClass().
Fix that.
Fix #79491: Search for .user.ini extends up to root dir
The `start` parameter of `php_cgi_ini_activate_user_config` is supposed
to hold the byte offset of the doc root in the given `path`. However,
the current expression which fixes a potential type incompatibility
will ever only evaluate to zero or one, because it uses the *logical*
and operator (`&&`). Furthermore we notice that subtracting one from
`doc_root_len` is not necessary, so there is even no need for the
`start` parameter at all.
This is the change from GH-5417 but for FPM. This was stripping the
last character from the doc_root. Given how it is used, this should
be harmless, but let's make it less confusing...
Joe Cai [Sun, 19 Apr 2020 23:03:11 +0000 (09:03 +1000)]
Fix #79497: Fix php_openssl_subtract_timeval()
I stumbled upon this while debugging a strange issue with
stream_socket_client() where it randomly throws out errors when
the connection timeout is set to below 1s. The logic to calculate
time difference in php_openssl_subtract_timeval() is wrong when
a.tv_usec < b.tv_usec, causing connection errors before the timeout
is reached.
Tyson Andre [Sun, 19 Apr 2020 15:53:36 +0000 (11:53 -0400)]
Speed up ZEND_SWITCH_STRING/ZEND_SWITCH_LONG for wrong type
This has the minor benefit of avoiding loading the address of the
jump table when the expression for the switch isn't a string/long.
gcc doesn't seem to optimize that.
The previous function body is the original implementation: ad8652818a5
```
// Before: 0.267s, after: 0.265s
function test_switch($x) {
for ($i = 0; $i < 10000000; $i++) {
switch ($x) {
case 'a':
case 'b':
echo "i=$i\n";
}
}
}
test_switch(null);
```
This is only used in reflection, where doing a simple string check
is acceptable.
I'm also dropping the "dtor" printing in the reflection dump.
Dtors are just one of many magic methods, I don't think there's
a point in explicitly highlighting them, when the name is already
unambiguous.
Don't check all the remaining arguments after one check failed.
I don't think this makes an observable behavior difference,
because we already suppress duplicate exceptions in argument
type error reporting.
`func_get_args()` may return `zend_empty_array`, which has refcount 2
to enforce separation. We have to cater to that during type inference
so that the optimization in the JIT macro `SEPARATE_ARRAY` doesn't
prevent the separation.
This is fairly annoying. Add adapter functions for cases where
we are discarding a return value.
Some of the issues are legitimate in that we were previously
truncating some unsigned long return values to int implicitly,
though I doubt it makes a difference in practice.
Add -Wextra compiler warnings and exclude the trigger happy ones
The compile warnings which are explicitly suppressed are:
* -Wno-implicit-fallthrough
* -Wno-unused-parameter
* -Wno-sign-compare
* -Wno-clobbered, only with GCC
The one reporting the 'bug' seemed to think that since the method name was prefixed with
`parent::`, it should call the method in the superclass of the *class where this code appears*.
However, `$this` might be an instance of a subclass. If so, then it is quite reasonable that
`call_user_func_array` will call the method as defined in the superclass of *the receiver*.
So the 'bug' is not really a bug. Therefore, there is no need for an XFAIL in the tests. They
should just pass.
Amend tests to reflect the actual expected behavior of `call_user_func_array`, not what the
person who reported bug 48770 thought it should be.
The callable name is provided also if it's not callable, in which
case it's basically "what it would be if it were callable", which
is ClassName::__invoke. The current behavior of casting the object
to string makes very little sense as this will just throw an
exception for most objects.
Add Intl resource bundle files for big-endian architecture.
Little and Big endian files have their own designated folder.
Both use the ASCII charset family.
We may want to add a big-endian/EBCDIC charset family resource bundle in the future.
The build script is currently left untouched as it seems to mostly be for Windows.