Return the original value. If we don't return the original value,
we need to own the zval, which we don't.
For clarity also switch things to work on a zend_string* value
instead of a zval*.
Factor out the core logic into a separate function and drop the
"clever" code that combines iteration through variadic arguments
and arrays.
This fixes bug #79829 as a side effect.
With named arguments in php 8.0, it's important that php's modules
or PECL extensions using gen_stub.php don't generate functions
with duplicate names.
Warn if a parameter name is repeated,
even if the last occurrence is a variadic parameter
Closes GH-6035
`tolower()` returns an `int`, so we must not convert to `char` which
may be `signed` and as such may be subject to overflow (actually,
implementation defined behavior).
Closes GH-6007
Set HAS_TYPE_HINTS flag if the variadic parameter is types as well,
and make sure it has a distinct name. This was previously missed,
because the variadic parameter is not part of num_args.
The fpm code actually uses aa_change_profile(), not change_hat(). Test
for the correct function. (libapparmor always has both, so this is just
a correctness fix.)
Closes GH-6037.
PHP-Parser 4.3.0 failed to recognize that the `match` keyword could be
used as a class constant name.
4.9.0 also adds support for keywords in namespaced names.
See https://github.com/nikic/PHP-Parser/releases
So forcing regeneration of spl_iterators.stub.php failed.
PECL extensions using gen_stub.php would also be affected
by the same issue.
```
ext/spl/spl_iterators.stub.php
public function __construct(Iterator $iterator, string $regex,
int $mode = self::MATCH, int $flags = 0, int $preg_flags = 0) {}
```
Testing: I successfully regenerated stubs by setting forceRegeneration to true
and running `touch **/*.stub.php; make`.
The stubs did not change, as expected.
Closes GH-6036
If we do not specify the exact version of the .NET framework to use,
the default CLR is loaded, which is typically CLR 2, which is very old.
Therefore, we introduce a `PHP_INI_SYSTEM` setting, which allows users
to choose the desired .NET framework version. The value of the setting
are the first three parts of the framework's version number, separated
by dots, and prefixed with "v", e.g. "v4.0.30319". If the value of the
INI setting is `NULL` (the default) or an empty string, the default CLR
is used.
Internally, we switch from the most generic `CoCreateInstance()` to
`CorBindToRuntime()` which is implemented in mscoree.dll. To avoid the
hard dependency to that library, we load dynamically.
So this fix is supposed to be fully backwards compatible.
Closes GH-5949