It's indeed unsafe to treat zend_internal_function as zend_function, because
sizeof(zend_internal_function) < sizeof(zend_function), which can lead to buffer
overflows. This might also be UB.
Either way, this would need to be addressed in the whole codebase.
For the following benchmark code:
```php
$dom = DOM\XMLDocument::createEmpty();
for ($i = 0; $i < 1000*100; $i++) $dom->createElementNS("urn:a", "thisisaveryverylongname");
```
We obtain the following on an i7-4790:
```
Benchmark 1: ./sapi/cli/php bench.php
Time (mean ± σ): 34.5 ms ± 1.2 ms [User: 31.4 ms, System: 2.9 ms]
Range (min … max): 32.4 ms … 39.3 ms 84 runs
Benchmark 2: ./sapi/cli/php_old bench.php
Time (mean ± σ): 36.6 ms ± 1.6 ms [User: 33.6 ms, System: 2.9 ms]
Range (min … max): 34.3 ms … 45.3 ms 80 runs
Summary
./sapi/cli/php bench.php ran
1.06 ± 0.06 times faster than ./sapi/cli/php_old bench.php
```
OpenSSL 3.x relegated a set of insecure algorithms to a "legacy"
provider which is not loaded by default. Some of these algorithms
have utility beyond encryption such as for hashing, e.g., DES[1]
Add a compile-time option to load the legacy provider in 3.x. When
enabled, also load the default provider because loading any provider
explicitly disables auto-loading the default provider.
[1] 9e40015748/go/vt/vtgate/vindexes/hash.go (L157)
Closes GH-13951
Because the default characters are defined in the stub file, and the
stub file is UTF-8 (typically), the characters are encoded in the string
as UTF-8. When using a different character encoding, there is a mismatch
between what mb_trim expects and the UTF-8 encoded string it gets.
One way of solving this is by making the characters argument nullable,
which would mean that it always uses the internal code path that has the
unicode codepoints that are defaulted actually stored as codepoint
numbers instead of in a string.
Co-authored-by: @ranvis
`zend_strtod.c` uses a global state (mostly an allocation freelist) protected by a mutex in ZTS builds. This state is used by `zend_dtoa()`, `zend_strtod()`, and variants. This creates a lot of contention in concurrent loads. `zend_dtoa()` is used to format floats to string, e.g. in sprintf, json_encode, serialize, uniqid.
Here I move the global state to the thread specific `executor_globals` and remove the mutex.
The impact on non-concurrent environments is null or negligible, but there is a considerable speed up on concurrent environments, especially on Alpine/Musl.
This is addon to the GH-13727 bug fix. When configuring the build with:
./configure CFLAGS=-Werror=strict-prototypes
libtool check for parsing nm command would fail:
checking command to parse /usr/bin/nm -B output from cc object... failed
Upstream libtool has this specific check already fixed. Note that this
works only with Autoconf version 2.72 and later and is preparation for
future compilers that might have this error enabled by default.