`shm_get()` (not to be confused with `shmget()`) returns `NULL` if
reallocation fails; we need to cater to that when calling the function.
Closes GH-9872.
We need to allocate buffers for the file mapping names which are large
enough for all potential keys (`key_t` is defined as `int` on Windows).
Regarding the test: it's probably never a good idea to use hard-coded
keys (should always use `ftok()` instead), but to reliably reproduce
this Windows specific issue we need to, and it shouldn't be an issue on
that OS.
Closes GH-7448.
We map the POSIX semantics of `IPC_PRIVATE` by creating unnamed file
mapping objects on Windows. While that is not particularly useful for
ext/shmop, which is the only bundled extension which uses `shmget()`,
it may be useful for external extensions.
While the `$command` passed to `proc_open()` had to be wrapped in
double-quotes manually, that was implicitly done for all other
program execution functions. This could easily introduce bugs and
even security issues when switching from one to another program
execution function.
Furthermore we ensure that the additional quotes are always
unwrapped regardless of what is passed as `$command` by passing
the `/s` flag to cmd.exe. As it was, `shell_exec('path with
spaces/program.exe')` did execute program.exe, but adding an
argument (`shell_exec('path with spaces/program.exe -h)`) failed
to execute program.exe, because cmd.exe stripped the additional
quotes.
While these changes obviously can cause BC breaks, we feel that in
the long run the benefits of having consistent behavior for all
program execution functions outweighs the drawbacks of potentially
breaking some code now.
This patch saves one CPU instruction on each "_tsrm_ls_cache" access in ZTS CLI/CGI/FPM builds.
This reduce typical instruction sequence for EG(current_execute_data) access from 4 to 3 CPU instructions.
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.
(cherry picked from commit bf242d58e7)
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.
- 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
This simplifies TSRM build steps a bit and avoids doing unnecessary
steps:
- The `PTHREADS_CHECK_COMPILE` can called inside the for loops only
since this is only where the `$pthreads_checked` variable is used.
- Assigning variables can be then done only in the configure.ac
once.
- use `m4_include()` instead of the `sinclude()` in the middle of
the build steps.
- The `$threads_result` variable is not used in the code or in
extensions.
`time_t` defaults to `_time64` (which is 64bit signed) even on x86, but
`Int32x32To64()` truncates it to signed 32bit. We replace the macro
with the "manual" calculation.
This macro is not needed anymore. The AC_PROG_CC is done in the main
configure.ac file and the ranlib check is done by the bundled libtool
macros.
Closes GH-4339
Removed unused checks:
- mbsinit check removed, HAVE_MBSINIT removed (not used in php-src)
- mempcpy check removed, HAVE_MEMPCPY removed (not used in php-src anymore since
560ed89bfb which uses PHP's own implementation)
- strpncpy check removed, added via a8c9e893b6 and
not used.
- setpgid check removed since HAVE_SETPGID is not used
Moved to a central configure.ac:
- fpclass
- mbrlen moved to configure.ac (since the HAVE_MBRLEN is used accross the php-src)
- sigprocmask
- getcwd
- getwd
- glob
- strfmon
- nice
Duplicated checks removed:
- gethostname
- getlogin
- getpwuid_r
- socketpair
- mprotect check simplified