Commit Graph

675 Commits

Author SHA1 Message Date
Christoph M. Becker
58ad403cec
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81407: shmop_open won't attach and causes php to crash
2021-09-02 23:18:53 +02:00
Christoph M. Becker
f3d24af74f
Fix #81407: shmop_open won't attach and causes php to crash
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.
2021-09-02 23:16:48 +02:00
Derick Rethans
804420b011 Detect musl libc to not set tls_model attribute on that platform
This fixes:
``_tsrm_ls_cache: initial-exec TLS resolves to dynamic definition``
in shared extensions.
2021-05-21 09:02:46 +01:00
Dmitry Stogov
3b377b51a2 Fixed bug #80814 (threaded mod_php won't load on FreeBSD: No space available for static Thread Local Storage) 2021-03-10 16:03:47 +03:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
twosee
1b85e749c7 Fix warning of strict-prototypes
Closes GH-5673.
2020-06-07 10:36:50 +02:00
Christoph M. Becker
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
George Peter Banyard
1f72dd89a5 Fix [-Wundef] warning in TSRM 2020-05-20 14:01:10 +02:00
George Peter Banyard
3302ffb09e Fix bogus check in TSRM and adjust TSRM_ASSERT macro
Closes GH-5562
2020-05-18 12:24:23 +02:00
George Peter Banyard
0e4c7b3264 utime is always available on Windows
Therefore drop useless preprocessor if check

Closes GH-5563
2020-05-13 12:05:29 +02:00
Christoph M. Becker
e749db4047 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79566: Private SHM is not private on Windows
2020-05-05 11:41:31 +02:00
Christoph M. Becker
80b5006196 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79566: Private SHM is not private on Windows
2020-05-05 11:41:04 +02:00
Christoph M. Becker
f33cf52faf Fix #79566: Private SHM is not private on Windows
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.
2020-05-05 11:38:29 +02:00
Christoph M. Becker
9ca449e0a8 Make quoting of cmd execution functions consistent
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.
2020-02-17 23:17:17 +01:00
Christoph M. Becker
d4927668bb Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78538: shmop memory leak
2020-01-03 18:13:44 +01:00
Christoph M. Becker
4c6ad099c6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78538: shmop memory leak
2020-01-03 18:13:04 +01:00
Christoph M. Becker
18172303f4 Fix #78538: shmop memory leak
If the descriptor's refcount drops to zero, we have to unmap the
respective file view, to avoid leaking memory.
2020-01-03 18:10:29 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Christoph M. Becker
e0a213d98f Make MSVC happy again
MSVC complains about unsupported preprocessor syntax, so we employ the
same workaround as in zend_cpuinfo.h.
2019-09-20 12:51:03 +02:00
Dmitry Stogov
2aefd11211 Optimize access to thread local cache.
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.
2019-09-18 14:03:07 +03:00
Christoph M. Becker
9ea39d15ab Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78282: atime and mtime mismatch
2019-08-06 17:28:11 +02:00
Christoph M. Becker
954543cec6 Fix #78282: atime and mtime mismatch
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)
2019-08-06 17:25:54 +02:00
Christoph M. Becker
6e630fe79b Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78282: atime and mtime mismatch
2019-07-13 09:45:14 +02:00
Christoph M. Becker
bf242d58e7 Fix #78282: atime and mtime mismatch
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.
2019-07-13 09:44:46 +02:00
Peter Kokot
930e38ec5c Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove tsrm_config_common.h
2019-07-13 01:58:38 +02:00
Peter Kokot
33994ebd95 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
2019-07-13 01:58:01 +02:00
Nikita Popov
98495f7f30 Merge branch 'PHP-7.4' 2019-07-12 13:14:38 +02:00
Nikita Popov
709897c2a5 Remove unused tsrm_strtok_r() function
There is also a php_strtok_r() function, which is actually used,
but nothing uses the tsrm_strtok_r() variant...
2019-07-12 13:14:24 +02:00
Peter Kokot
f99adb4bb5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove TSRM/tsrm_config.w32.h
2019-07-10 21:20:10 +02:00
Peter Kokot
d63fdced2e Remove TSRM/tsrm_config.w32.h
The tsrm_config.w32.h file is a simple wrapper for already defined
symbols and includes elsewhere.

Closes GH-4383
2019-07-10 21:19:44 +02:00
Peter Kokot
b36b6c5fdf Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove PTHREADS_ASSIGN_VARS
2019-07-05 23:30:51 +02:00
Peter Kokot
1c9e8e8f6a Remove PTHREADS_ASSIGN_VARS
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.
2019-07-05 23:26:20 +02:00
Christoph M. Becker
f71268ac67 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78241: touch() does not handle dates after 2038 in PHP 64-bit
2019-07-03 10:03:59 +02:00
Christoph M. Becker
b4c81be9c5 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78241: touch() does not handle dates after 2038 in PHP 64-bit
2019-07-03 10:03:14 +02:00
Christoph M. Becker
5e5b7cb4d4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix #78241: touch() does not handle dates after 2038 in PHP 64-bit
2019-07-03 10:02:22 +02:00
Christoph M. Becker
44c8b7414c Fix #78241: touch() does not handle dates after 2038 in PHP 64-bit
`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.
2019-07-03 09:59:17 +02:00
Peter Kokot
b1ef50091d Remove some old BeOS artefacts
- checking for beos systems is no longer relevant in configure.ac
- usage of undefined constant BETHREADS removed.

Closes GH-4346
2019-07-02 22:08:54 +02:00
Peter Kokot
b757d49cb5 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove TSRM_BASIC_CHECKS
2019-07-01 13:26:17 +02:00
Peter Kokot
30c1c53164 Remove TSRM_BASIC_CHECKS
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
2019-07-01 13:23:41 +02:00
Peter Kokot
98d0892dd8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Sync functions checks
2019-06-30 23:59:47 +02:00
Peter Kokot
9a3c8e51e3 Sync functions checks
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
2019-06-30 23:57:54 +02:00
Joe Watkins
b98cd0719a
Merge branch 'PHP-7.4'
* PHP-7.4:
  implement tsrm_is_shutdown API
2019-06-28 10:27:39 +02:00
Joe Watkins
68485f8ab4
implement tsrm_is_shutdown API 2019-06-28 10:27:19 +02:00
Dmitry Stogov
7a236b6761 Attempt to fix JIT on Mac OSX ZTS build 2019-06-17 17:08:58 +03:00
Joe Watkins
5fd027e35c
Merge branch 'PHP-7.4'
* PHP-7.4:
  This reverts 0e5d4ea555 to fix the build on MacOSX
2019-06-11 15:15:31 +02:00
Joe Watkins
69190ce5c0
This reverts 0e5d4ea555 to fix the build on MacOSX
On Mac thread_local and __thread are not ABI compatible, in addition, thread_local
comes with additional overhead, __thread seems to be the most suitable linkage to use
regardless of c++/c
2019-06-11 15:13:27 +02:00
Nikita Popov
623eedbbd5 Merge branch 'PHP-7.4' 2019-06-04 16:14:46 +02:00
Nikita Popov
18060e5923 Merge branch 'PHP-7.3' into PHP-7.4 2019-06-04 16:14:26 +02:00
Nikita Popov
a4633b13d4 Merge branch 'PHP-7.2' into PHP-7.3 2019-06-04 16:14:14 +02:00
Nikita Popov
2d3bc71e89 Reload tsrmls_id in release builds as well
If TSRM is shut down and started again (something that phpdbg does),
then tsrmls_id needs to be reloaded everywhere. As tsrmls_id
update is a rare operation, doing that shouldn't be a problem.
2019-06-04 16:12:59 +02:00