This removes the --enable-opcache/--disable-opcache configure switch. OPcache
is now always builtin. The default value of opcache.enable and
opcache.enable_cli is unchanged.
RFC: https://wiki.php.net/rfc/make_opcache_required
Closes GH-18961.
Co-authored-by: Tim Düsterhus <tim@tideways-gmbh.com>
We use linker relocations to fetch the TLS index and offset of _tsrm_ls_cache.
When building Opcache statically, linkers may attempt to optimize that into a
more efficient code sequence (relaxing from "General Dynamic" to "Local Exec"
model [1]). Unfortunately, linkers will fail, rather than ignore our
relocations, when they don't recognize the exact code sequence they are
expecting.
This results in errors as reported by GH-15074:
TLS transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against
`_tsrm_ls_cache' at 0x12fc3 in section `.text' failed"
Here I take a different approach:
* Emit the exact full code sequence expected by linkers
* Extract the TLS index/offset by inspecting the linked ASM code, rather than
executing it (execution would give us the thread-local address).
* We detect when the code was relaxed, in which case we can extract the TCB
offset instead.
* This is done in a conservative way so that if the linker did something we
didn't expect, we fallback to a safer (but slower) mechanism.
One additional benefit of that is we are now able to use the Local Exec model in
more cases, in JIT'ed code. This makes non-glibc builds faster in these cases.
Closes GH-18939.
Related RFC: https://wiki.php.net/rfc/make_opcache_required.
[1] https://www.akkadia.org/drepper/tls.pdf
We are adding extra (non-phpt) test suites in [1] and [2]. In order to
avoid touching CI files too often (which are maintained in 8.1 and merged in
upper branches), we add a single entry point to call the extra tests. The entry
point can be updated in branches without synchronizing all the way from 8.1.
CI files still need to be touched to install dependencies of these tests,
but this should be manageable as these do not change often and are the same
in every branch.
Closes GH-19242.
[1] https://github.com/php/php-src/pull/16987
[2] https://github.com/php/php-src/pull/18939
This reduces the chances of confusion between opcode handlers used by the
VM, and opcode handler functions used for tracing or debugging. Depending
on the VM, zend_vm_opcode_handler_t may not be a function. For instance in
the HYBRID VM this is a label pointer.
Closes GH-19006
Reduce the number of global functions by moving it to static method
`FileInfo::getFileDocComments()`. Since it is only used by
`FileInfo::parseStubFile()`, also make it private.
This new class holds the logic for applying different flags based on the PHP
version, and replaces `VariableLike::addFlagForVersionsAbove()` (use
`VersionFlags::addForVersionsAbove()`) and `generateVersionDependentFlagCode()`
(use `VersionFlags::generateVersionDependentFlagCode()`).
In preparation for moving this logic to a dedicated class, add support for a
maximum version of PHP in the generation of version-dependent flags. This
replaces the manual logic in `FuncInfo::getFunctionEntry()` to split up the
flags that are used when PHP 8.4 is not supported.
* opcache: Reset `accel_startup_ok` after shutting down
This is necessary for phpdbg, which runs multiple startup/shutdown cycles in
the same process.
* opcache: Disallow changing `opcache.memory_consumption` when SHM is set up
Normally changing the INI value is not possible after SHM is set up, since it
is `PHP_INI_SYSTEM`. FPM is a notable exception: SHM is set up in the master
process, but when spawning the individual pools, the `php_admin_value` config
option can be used to change `PHP_INI_SYSTEM` INIs on a per-pool basis. This
does not work for this option, since it will only be read on early start,
leading to misleading PHPInfo output, since the INI value appears to be
successfully set and since some of the calculated values are derived from the
INI value rather than the actual value.
This function always returned SUCCESS unconditionally; removing the return type
revealed some impossible code for handling FAILURE that could also be removed.
Specifically, it is added to openssl_public_encrypt() and
openssl_private_decrypt() functions. The purpose is to specify digest
algorithm for OEAP padding. It currently defaults to SHA1 for some
OpenSSL versions which is not preferred for modern setup and causes
problems in compatibility with web crypto.
Closes GH-19223
* Fix GH-19044: Protected properties are not scoped according to their prototype
* Adjust after review
* Simplify to using prototype even for asymmetric visibility