Commit Graph

13518 Commits

Author SHA1 Message Date
Remi Collet
cdfc4d3596
Fix GH-7883 don't close not open file handle
don't create a stream if file is not open
2022-01-18 14:49:56 +01:00
Christoph M. Becker
69f6b09b2a
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7902: mb_send_mail may delimit headers with LF only
2022-01-18 13:09:52 +01:00
Christoph M. Becker
03816fba46
Fix GH-7902: mb_send_mail may delimit headers with LF only
Email headers are supposed to be separated with CRLF. Period.

We introduce a `CRLF` macro for better comprehensibility right away.

Closes GH-7907.
2022-01-18 13:08:08 +01:00
Christoph M. Becker
8d2ed194bf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7896: Environment vars may be mangled on Windows
2022-01-17 23:45:49 +01:00
Christoph M. Becker
93a3c71eb4
Fix GH-7896: Environment vars may be mangled on Windows
When bug 77574[1] has been fixed, the fix only catered to variables
retrieved via `getenv()` with a `$varname` passed, but neither to
`getenv()` without arguments nor to the general import of environment
variables into `$_ENV` and `$_SERVER`.  We catch up on this by using
`GetEnvironmentStringsW()` in `_php_import_environment_variables()` and
converting the encoding to whatever had been chosen by the user.

[1] <https://bugs.php.net/bug.php?id=75574>

Closes GH-7928.
2022-01-17 23:44:41 +01:00
Christoph M. Becker
79bf39e917
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7875: mails are sent even if failure to log throws exception
2022-01-17 22:32:37 +01:00
Christoph M. Becker
478edcdacb
Fix GH-7875: mails are sent even if failure to log throws exception
We explicitly check for an exception after the logging attempt, and
bail out in that case.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

Closes GH-7878.
2022-01-17 22:30:25 +01:00
Remi Collet
e31c54d025
fix GH-7899 Regression in unpack for negative int value 2022-01-13 11:47:19 +01:00
Christoph M. Becker
1632ebb542
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7867: FFI::cast() from pointer to array is broken
2022-01-10 23:59:55 +01:00
Christoph M. Becker
703cac33db
Fix GH-7867: FFI::cast() from pointer to array is broken
Casting from pointer to array is special, so we must not fall back to
the general FFI casting.  There is a particular issue regarding the
size comparison, namely that the pointer size is always 8 for 64bit
architectures, but the size of an array is determined by its
declaration, so as is casting a pointer to an array with more than 8
elements would fail, but casting to an array with less than 9 elements
succeeds, but the internal pointer would point to some arbitrary
memory.

We fix this by properly supporting the cast.  An alternative would be
to deny this kind of cast generally, since it is not necessarily safe.
However, FFI isn't necessarily safe anyway.

We also check pointer/array type compatibility when casting.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-7876.
2022-01-10 23:58:39 +01:00
David Carlier
be22018f35
Fix pcntl_rfork build for DragonFlyBSD
RFTSIGZMB flag unsupported, guarding with the said flag instead of system
in case the implementaion catches up with FreeBSD's.

Closes GH-7918.
2022-01-10 13:10:30 +01:00
Christoph M. Becker
4833362844
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81430: Attribute instantiation leaves dangling pointer
2022-01-10 12:42:18 +01:00
Benjamin Eberlei
2f6a06ccb0
Fix #81430: Attribute instantiation leaves dangling pointer
By switching attribute constructor stackframe to be called via
trampoline the stack allocation is not causing dangling pointers
in the zend_observer API anymore.

Co-Authored-By: Florian Sowade <f.sowade@suora.com>
Co-Authored-By: Christopher Becker <cmbecker69@gmx.de>
Co-Authored-By: Dmitry Stogov <dmitry@zend.com>

Closes GH-7885.
2022-01-10 12:40:15 +01:00
Christoph M. Becker
2b07513192
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak on invalid port
2022-01-08 21:06:39 +01:00
David Carlier
c99a026c9c
Fix memory leak on invalid port
Closes GH-7911.
2022-01-08 21:04:55 +01:00
Stefano Arlandini
46bec6de42 Fix the OpenMetrics response format returned by the FPM status page
Closes GH-7843, closes GH-7842
2022-01-04 23:01:10 +00:00
Patrick Allaert
4ae75623fd
Preparing for 8.1.3-dev 2022-01-04 19:29:41 +01:00
Christoph M. Becker
623b21220b
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix ext/sockets build on Haiku
2022-01-04 14:12:56 +01:00
David Carlier
09165ace37
Fix ext/sockets build on Haiku
The `SOCK_RDM` datagram option is unsupported on Haiku; instead `ifreq`
has direct access to `ifr_index`.

Closes GH-7849.
2022-01-04 14:10:50 +01:00
Gabriel Caruso
d70c69839c
Prepare for PHP 8.0.16 2022-01-04 09:40:46 -03:00
Jeremie Courreges-Anglas
70b02d75f2
riscv64 support for fibers
We add riscv64 assembly files from Boost, needed for fibers support,
and hook up riscv64 fibers support during configure.

Closes GH-7879.
2022-01-04 12:06:37 +01:00
Christoph M. Becker
ae9e98640a
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix bug where large bigints may be truncated
2021-12-30 19:10:36 +01:00
NathanFreeman
b3903515bf
Fix bug where large bigints may be truncated
Unless stringified results are requested, we need to parse large
bigints as unsigned, to avoid wrap-around behavior.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7837.
2021-12-30 19:07:36 +01:00
Kamil Tekiela
8869bbe0e9
Fix bug GH-7746 (mysqli_sql_exception->sqlstate is inaccessible)
Closes GH-7747
2021-12-30 14:23:06 +00:00
Christoph M. Becker
d58c48d45d
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers"
2021-12-27 21:10:40 +01:00
Christoph M. Becker
ee610947ce
Revert "Fix zend_observer_fcall_end_all() accessing dangling pointers"
This reverts commit 76e2a8380e.  Cf.
<76e2a8380e (r62560239)>.
2021-12-27 21:08:51 +01:00
Christoph M. Becker
d4c07df4df
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix zend_observer_fcall_end_all() accessing dangling pointers
2021-12-27 18:20:48 +01:00
Florian Sowade
76e2a8380e
Fix zend_observer_fcall_end_all() accessing dangling pointers
This may happen, when the execute_data was allocated on the stack.  We
ensure that the runtime cache pointer is not NULL before dereferencing
it.

This is a partial fix for bug 81430.

Closes GH-7665.
2021-12-27 18:19:13 +01:00
David Warner
f82593d597
Fix GH-7815: php_uname doesn't recognise latest Windows versions
We check `dwBuildNumber` to determine newer Windows versions.

Closes GH-7816.
2021-12-27 15:08:11 +01:00
Christoph M. Becker
a6ddd1a14d
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
2021-12-26 12:59:06 +01:00
Christoph M. Becker
fd3fc5c193
Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
Like `hash_file()`, `hash_hmac_file()` expects a filename, and not some
string data.  Fixing this now, constitutes a (hopefully small) BC break
though.

Closes GH-7828.
2021-12-26 12:55:53 +01:00
Christoph M. Becker
0ed39ed809
Fix GH-7809: Cloning a faked SplFileInfo object may segfault
While the `path` is not supposed to be `NULL` for normal operation, it
is possible to create `SplFileInfo` objects where that is the case, and
we must not follow the null pointer.

Closes GH-7814.
2021-12-23 23:10:51 +01:00
Christoph M. Becker
9d2dc1e9a9
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Avoid void* arithmetic in sockets/multicast.c on NetBSD
2021-12-23 16:21:28 +01:00
David Carlier
3f0bb67361
Avoid void* arithmetic in sockets/multicast.c on NetBSD
On NetBSD, ifconf.ifc_buf member, unlike most of platforms, is a void
pointer.

We also fix the cpuinfo declarations with empty parameter lists.

Closes GH-7819.
2021-12-23 16:17:30 +01:00
Petr Sumbera
069bbf3e80
Fix zend_fibers.c build with ZEND_FIBER_UCONTEXT
Avoids (Solaris SPARC) issue:
  zend_fibers.c:77:9: error: unknown type name 'ucontext_t'

Closes GH-7773.
2021-12-20 14:21:50 +01:00
Christoph M. Becker
a000af6ecc
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix FILTER_FLAG_NO_RES_RANGE flag
2021-12-19 16:25:54 +01:00
Yifan Tong
3587e13ab3
Fix FILTER_FLAG_NO_RES_RANGE flag
`2001:10::/28` is a reserved IPv6 range. But there's a typo in GH-7476,
which caused IPv6 address like `240b:0010::1` will be filtered by the
flag `FILTER_FLAG_NO_RES_RANGE`.

http://www.faqs.org/rfcs/rfc6890.html

Closes GH-7790.
2021-12-19 16:24:34 +01:00
Christoph M. Becker
5910e1d6cd
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81679: Tracing JIT crashes on reattaching
2021-12-15 15:39:58 +01:00
Christoph M. Becker
49380b59d2
Fix #81679: Tracing JIT crashes on reattaching
When a new process reattaches to OPcache, tracing JIT causes segfaults,
because each new process allocates its own `zend_jit_traces` and
`zend_jit_exit_groups` in SHM, although these need to be shared between
all processes.

We solve that by only allocating these structs for the first process,
and store the pointers in `accel_shared_globals`, so we can reassign
them when a new process reattaches.

Closes GH-7776.
2021-12-15 15:37:23 +01:00
Christoph M. Becker
c35be03628
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7765: php_oci_cleanup_global_handles segfaults at second call
2021-12-12 22:38:55 +01:00
Christoph M. Becker
c435e67746
Fix GH-7765: php_oci_cleanup_global_handles segfaults at second call
We must not use the TSRM accessor macros in GINIT and GSHUTDOWN, but
rather use the passed pointers directly.  For simplicity, we inline
`php_oci_cleanup_global_handles()`, and also the `PHP_OCI_CALL()`
macros; the latter are unlikely to be needed here, but don't hurt.

Closes GH-7766.
2021-12-12 22:38:00 +01:00
Christoph M. Becker
206c521a1f
Fix GH-7757: Multi-inherited final constant causes fatal error
"Diamond" inheritance of final constants is supposed to be supported.

Closes GH-7767.
2021-12-12 22:22:51 +01:00
Christoph M. Becker
a708db9c8a
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7759: Incorrect return types for hash() and hash_hmac()
2021-12-12 15:47:19 +01:00
Christoph M. Becker
0b3a937670
Fix GH-7759: Incorrect return types for hash() and hash_hmac()
`hash()` and `hash_hmac()` never return `false`; only `hash_file()` and
`hash_hmac_file()` return `false` in case the data cannot be read.

Closes GH-7760.
2021-12-12 15:39:55 +01:00
Christoph M. Becker
926dee1b6f
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix error message allocation of PDO PgSQL
2021-12-12 15:18:32 +01:00
SATO Kentaro
778513f605
Fix error message allocation of PDO PgSQL
Closes GH-7723.
2021-12-12 15:17:36 +01:00
Christoph M. Becker
7daf01258d
Fix GH-7748: gethostbyaddr outputs binary string
`getnameinfo(3)` returns zero on success; all other values need to be
regarded as failure.
2021-12-10 17:38:36 +01:00
Christoph M. Becker
2362722dcf
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81585: cached_chunks are not counted to real_size on shutdown
2021-12-10 12:25:44 +01:00
Christoph M. Becker
5675ebe649
Fix #81585: cached_chunks are not counted to real_size on shutdown
The amount of allocated system memory is kept in `real_size`, including
the allocated `cached_chunks`.  Thus, we need to keep the proper count
at the end of the shutdown.

Closes GH-7745.
2021-12-10 12:24:06 +01:00
Christoph M. Becker
6f325104eb
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #75917: SplFileObject::seek broken with CSV flags
2021-12-06 19:02:32 +01:00