There are a few parts here:
* opcache should not be blocking signals while invoking compile_file,
otherwise signals may remain blocked on a compile error. While at
it, also protect SHM memory during compile_file.
* We should deactivate Zend signals at the end of the request, to make
sure that we gracefully recover from a missing unblock and signals
don't remain blocked forever.
* We don't use a critical section in deactivation, because it should
not be necessary. Additionally we want to clean up the signal queue,
if it is non-empty.
* Enable SIGG(check) in debug builds so we notice issues in the future.
The smart branch logic assumed b->start refers to the old offsets,
while b->start was already adjusted to the new offsets at this
point. Delay the change until later.
New opcache directives have been added recently which are returned
if using `ini_get_all('zend opcache')` but are not listed in the
directives if using `opcache_get_configuration()`. This fix adds
those missing directives as well as if `opcache.mmap_base` is used
instead of `opcache.lockfile_path`. Also adds a test to ensure the
directives match with both methods of fetching.
When cleaning nops in the dfa pass, we were always keeping the
smart branch inhibiting nop that occurs directly before the jump
instruction. However, as we skip unreachable blocks entirely, it
may happen that we need to keep a nop that occurs further back,
prior to the unreachable blocks. Account for that case now.
We should really do something about the smart branch situation,
this is very fragile...
opcache incorrectly handles PHAR files when opcache.validate_permission
option enabled, because it calls
access("phar://path-to/file.phar/path/inside.php", R_OK);
rather than
access("path-to/file.phar", R_OK)
This test is easily tripped by former test runs with other PHP
versions. To avoid such false positives, we check that there is at
least one respective OPcache file, and that all found OPcache user ID
folders have exactly 32 hexadecimal digits.
Also add PHP_TEST_EXTRA_ARGS environment variable, which allows
to pass on -c, -d etc flags provided by run-tests.php. Otherwise
we won't get the built-in server to run with opcache.
mysqli has an uncommon approach to 64-bit compatibility:
it will convert numbers that can't be represented on 32-bit
platforms to a string.
This is documented at
https://www.php.net/manual/en/mysqli-stmt.affected-rows.php#refsect1-mysqli-stmt.affected-rows-returnvalues
So if there's a query to a remote mysqli server that affects
more than 2.2 billion rows, then the opcache inference might be
incorrect.
(It's possible to add a MAY_BE_STRING_ON_32_BIT_PLATFORM bitflag macro to
account for this, but I don't think there's a need or want to?)
Patches 3162285b86
This is based on the list of php 7.4 functions using
MYSQLI_RETURN_LONG_INT in mysqli_api.c
https://www.php.net/manual/en/mysqli.get-charset.php
tests/mysqli_field_seek.phpt has a test of this returning an object.
Looking at the source in ext/mysqli/mysqli_nonapi.c,
this should be object|null, not array|null
This might actually cause bugs in opcache's inferences,
(no proof of this)
so it might make sense to pull this patch into an earlier minor version.
The num_args does not include variadics, so a "zero-arg" function
may accept additional arguments through that. No functions seem
to be affected right now, but they will be after #4175.