Allow multiple cache instances per user/host on Windows
Formerly, there was at most a single OPcache instance per user and the
so called system ID (which is determined from the PHP version).
Sometimes multiple OPcaches might be desired, though, particularly for
unrelated CLI scripts, which may even be necessary (e.g. for our test
suite in parallel mode).
We therefore introduce a new INI directive `opcache.cache_id` which
allows to configure independent OPcache instances for the same user.
We also use `GetUserNameW()` instead of `php_win32_get_username()`,
because the latter retrieves the user name encoded in the
`default_charset`, which can obviously yield different results for
different charsets, leading to OPcache "incompatibilities". Slightly
worse, some characters may not even be encodeable in the
`default_charset` and would be replaced by question marks, which could
result in different users sharing the same OPcache.
We also refactor, and re-use existing APIs to avoid duplicated code.
Revert "Remove Windows syslog script and syslog.reg"
This reverts commit cc44bad1f6ded6a62c9bbe4d145b5b418aa775f4, since its
assumptions were not correct. Actually, the classic event logging is
still used by PHP, because Windows 7 is still to be supported for a
while. Without the respective registry entries, the event log entries
show an error message regarding missing ID descriptions.
Thanks to ab@php.net for hinting at this!
Obviously, the part depending on ext/win32std has still to be
overhauled, and further improvements are conceivable; we will address
this in due course.
By adding a flag to avoid forced fstat for includes. The two fstats
will happen back to back and we don't care about a possible
invalidation.
I was hoping to move this higher up in the stack and make the
ISREG check somewhere in fsizer of fixup, but this doesn't really
seem to be possible. E.g. an FP stdin handle will not be a regular
file but of course needs to be allowed. Additionally custom stream
wrappers may not implement this functionality.
If we're including a file via PHP streams, we're not going to trust
the reported file size anyway and populate in a loop -- so don't
bother determining the file size in the first place. Only do this
for non-tty HANDLE_FP now, which is the only case where this
information was used.
Peter Kokot [Tue, 16 Jul 2019 20:39:09 +0000 (22:39 +0200)]
Remove unused build checks
- yp_get_default_domain was part of ext/yp
- functions checks produce HAVE_function_name symbols. These checks are
currently not used in php-src neither in the extensions out there.
- Removed symbols because they are not used in the code:
- HAVE_GCVT
- HAVE_PUTENV
- HAVE_PUTENV
- HAVE_SETVBUF
- HAVE_TEMPNAM
- HAVE_SIN (sin is also defined in C89 standard)
- HAVE_SETSOCKOPT
- HAVE_LOCKF
- HAVE_ISASCII
- HAVE_YP_GET_DEFAULT_DOMAIN (and other yp extension related unused checks)
- HAVE_LINK
- HAVE_USLEEP is already defined in Windows configuration header
- HAVE_LIBBIND has not been used in php-src for a while anymore
- HAVE_GETHOSTNAME is duplicated in Windows configuration header
Using mmap() is unsafe under concurrent modification. If the file
is truncated, access past the end of the file may occur, which will
generate a SIGBUS error. Even if the length does not change, the
contents may, which is a situation that the lexer certainly is not
prepared to deal with either.
Instead of handling shebang lines by adjusting the file pointer in
individual SAPIs, move the handling into the lexer, where this is
both a lot simpler and more robust. Whether the shebang should be
skipped is controlled by CG(skip_shebang) -- we might want to do
that in more cases.
Since mysqlnd is solely developed in the php-src repository, it makes
not much sense to have its own version number, particularly since
nobody cares to update it. Therefore we use PHP's version number, but
stick with the "mysqlnd" prefix which can be important to distinguish
the mysqli driver (libmysqlclient vs. mysqlnd).
Sebastian Pop [Wed, 10 Jul 2019 18:31:27 +0000 (18:31 +0000)]
vectorize string-escape with NEON
On this benchmark:
function simple_string_escape() {
$a = "test'asd'asd'' asd\'\"asdfasdf";
for($i=0; $i<512; $i++) {
$a .= chr($i%256);
}
for ($i = 0; $i < 100000; $i++) {
if ($a === stripslashes(addslashes($a)))
$a .= chr($i%256);
else {
echo "error at i=".$i."\n";
return;
}
}
}
the execution time goes from 21.619s to 8.139s (165% speedup) on an A1 Graviton instance.
When removing the characters that need escaping, i.e., this benchmark:
function simple_string() {
$a = "testasdasd asdasdfasdf";
for ($i = 0; $i < 10000; $i++) {
if ($a === stripslashes(addslashes($a)))
$a .= "test dedeasdf";
else {
echo "error at i=".$i."\n";
return;
}
}
}
the execution time goes from 2.932s down to 0.516s (468% speedup) on an A1 Graviton instance.
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.
Peter Kokot [Sun, 14 Jul 2019 12:45:27 +0000 (14:45 +0200)]
Remove duplicate PTHREADS template define
The undef PTHREADS converts to define if thread safety is configured.
This step is already done by pthreads m4 macros from TSRM so this now
removes duplicated PTHREADS defines from php_config.h.
Peter Kokot [Sun, 14 Jul 2019 11:50:05 +0000 (13:50 +0200)]
Remove timelib outdated defines
- TIMELIB_OMIT_STDINT is not used anymore since
https://github.com/derickr/timelib/commit/a171f99cf02baf39549ab7209e37565b8b8f6529
- HAVE_GETTIMEOFDAY was defined multiple times in Windows headers
- ext/date/lib/timelib_config.h.win32 does not seem to be used
This test does not work on Windows, if the child process has OPcache
enabled via php.ini, since TEMP is not set in the environment, so
OPcache can't find the base address file, and terminates the childs.
To avoid this (and potentially some other issues regarding missing
environment variables, such as PATH), we force the child process to
ignore any ini files.
The fix for bug #78241 assumed that `time_t` would always be 64bit, but
actually is 32bit for x86. We therefore enforce 64bit arithmetic to
avoid wrapping.
Peter Kokot [Fri, 12 Jul 2019 00:57:52 +0000 (02:57 +0200)]
Remove tsrm_config_common.h
- Checks and defines are not relevant for files that include it anymore
- Some code is not used anymore
- Defines are a bit duplicated in zend_portability.h and TSRM.h file
- MAXPATHLEN defs moved to zend_virtual_cwd.h