1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

128770 Commits

Author SHA1 Message Date
Yurun 5cf2659fa5 Replace the use of ZVAL_BOOL() with ZVAL_TRUE() or ZVAL_FALSE() where the value is fixed (#8815) 2022-06-20 13:34:44 +01:00
David CARLIER ec0331f499 intl ICU C++ code modernisation, making it closer to C++11 (#8650) 2022-06-20 13:07:28 +01:00
George Peter Banyard 8c50b8d797 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8563  Different results for seek() on SplFileObject and SplTempFileObject
2022-06-20 12:53:26 +01:00
George Peter Banyard 080fde2605 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8563  Different results for seek() on SplFileObject and SplTempFileObject
2022-06-20 12:53:01 +01:00
George Peter Banyard 6f87a5c633 Fix GH-8563 Different results for seek() on SplFileObject and SplTempFileObject
With memory streams if we get a NULL buffer we must not instantiate an empty line
2022-06-20 12:47:37 +01:00
Max Kellermann e67565f54c Zend, ext/opcache: use PR_SET_VMA_ANON_NAME (Linux 5.17) (#8234)
The new Linux 5.17 feature PR_SET_VMA_ANON_NAME can give names to
anonymous private memory, see:

 https://lwn.net/Articles/867818/

It can be useful while debugging, to identify which portion of the
process's memory belongs to which subsystem.

This is how /proc/PID/maps can look like:

 555ccd400000-555ccdc00000 r-xp 00000000 00:00 0                          [anon:huge_code_pages]
 7f6ec6600000-7f6ec6800000 rw-p 00000000 00:00 0                          [anon:zend_alloc]

The first mapping is the PHP executable copied to anonymous memory by
option "opcache.huge_code_pages".  The second one is a memory area for
the "zend_alloc.h" memory allocator library.

Unfortunately, it is not possible to give names to shared memory
(MAP_SHARED),  because Linux MAP_SHARED really maps /dev/zero (see
shmem_zero_setup()), which makes madvise_vma_anon_name() believe this
is a file mapping, failing the prctl() with EBADF.
2022-06-20 12:27:01 +01:00
Christoph M. Becker 640c1c3a09 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix potential use after free in php_binary_init()
2022-06-20 12:03:47 +02:00
Christoph M. Becker 5f24b85fd2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix potential use after free in php_binary_init()
2022-06-20 12:02:31 +02:00
Heiko Weber 93a44f8c50 Fix potential use after free in php_binary_init()
Closes GH-8791.
2022-06-20 12:00:50 +02:00
Dmitry Stogov fa75bd0785 Fix incorrect constant propagation for VERIFY_RETURN_TYPE
This fixes oss-fuzz #48104
2022-06-20 11:30:07 +03:00
Dmitry Stogov 3d4a55fea1 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix memory leak
2022-06-20 11:00:41 +03:00
Dmitry Stogov ee17296e7b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix memory leak
2022-06-20 11:00:32 +03:00
Dmitry Stogov 229e80c6ef Fix memory leak
This fixes oss-fuzz #48051
2022-06-20 10:59:37 +03:00
Jakub Zelenka 3f836641d5 Merge branch 'PHP-8.1' 2022-06-19 22:57:26 +01:00
Jakub Zelenka d9cca443ad Fix strict prototype for php_closelog 2022-06-19 22:56:44 +01:00
Christoph M. Becker 84b570e3ae Remove NEWS entries which are not supposed to be there
master/NEWS is not supposed to contain changes done prior to RC, if
these changes are also in lower branches.
2022-06-19 23:18:46 +02:00
Jakub Zelenka 305d5e12df Merge branch 'PHP-8.1' 2022-06-19 20:12:43 +01:00
Jakub Zelenka b3e6faed48 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-19 20:09:37 +01:00
Jakub Zelenka e330f443c9 Fix bug #67764: fpm: syslog.ident does not work 2022-06-19 20:05:49 +01:00
Ayesh Karunaratne 526af6ea67 [ci skip] Add true type support to UPGRADING file
Closes GH-8826.
2022-06-19 12:28:35 +02:00
Máté Kocsis 49d3dde211 Declare true return types (#8759) 2022-06-18 22:06:50 +02:00
Max Kellermann 2d986310f1 streams/xp_socket: eliminate poll() when MSG_DONTWAIT is available
If there is a zero timeout and MSG_DONTWAIT is available (or the
socket is non-blocking), the poll() call is not necessary, and we can
just call recv() right away.

Before this change:

 poll([{fd=4, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 0 (Timeout)
 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=4, revents=POLLIN}])
 recvfrom(4, "HTTP/1.1 301 Moved Permanently\r\n"..., 8192, MSG_DONTWAIT, NULL, NULL) = 348
 poll([{fd=4, events=POLLIN|POLLPRI|POLLERR|POLLHUP}], 1, 0) = 1 ([{fd=4, revents=POLLIN}])
 recvfrom(4, "", 1, MSG_PEEK, NULL, NULL) = 0

After this change:

 recvfrom(4, 0x7ffe0cc719a0, 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
 poll([{fd=4, events=POLLIN|POLLERR|POLLHUP}], 1, 60000) = 1 ([{fd=4, revents=POLLIN}])
 recvfrom(4, "HTTP/1.1 301 Moved Permanently\r\n"..., 8192, MSG_DONTWAIT, NULL, NULL) = 348
 recvfrom(4, "", 1, MSG_PEEK|MSG_DONTWAIT, NULL, NULL) = 0

The first poll() is replaced by recvfrom(), and the third poll() is
omitted completely.

ext/openssl/xp_ssl: eliminate poll() when MSG_DONTWAIT is available

If there is a zero timeout and MSG_DONTWAIT is available (or the
socket is non-blocking), the poll() call is not necessary, and we can
just call recv() right away.

Closes GH-8092.
2022-06-18 19:44:32 +01:00
Christoph M. Becker 7d6821a98a Remove superfluous snapshot_build_exclusions
These configuration options have been removed, so there is no need to
still cater to them.

Closes GH-8792.
2022-06-18 14:26:51 +02:00
Christoph M. Becker 790be97fc9 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-8778: Integer arithmethic with large number variants fails
2022-06-18 11:51:52 +02:00
Christoph M. Becker 5869e8a0ca Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-8778: Integer arithmethic with large number variants fails
2022-06-18 11:50:14 +02:00
Christoph M. Becker 651e0cc187 Fix GH-8778: Integer arithmethic with large number variants fails
When casting a `variant` to `int`, we need to heed the proper `zval`
type, which is an signed 64bit integer on x64, while `VT_INT` is only
a signed 32bit integer.

Closes GH-8779.
2022-06-18 11:48:49 +02:00
Pierrick Charron b08076ef97 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed CURLOPT_TLSAUTH_TYPE is not treated as a string option.
2022-06-17 19:54:45 -04:00
Pierrick Charron bb010adf29 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-17 19:52:44 -04:00
Pierrick Charron d84b972658 Fixed CURLOPT_TLSAUTH_TYPE is not treated as a string option. 2022-06-17 19:51:58 -04:00
Christoph M. Becker cedd4598b2 [ci skip] Merge branch 'PHP-8.1'
* PHP-8.1:
  [ci skip] Fix NEWS format
2022-06-17 19:35:51 +02:00
Christoph M. Becker a8497cb8fe [ci skip] Fix NEWS format 2022-06-17 19:34:48 +02:00
tobil4sk 5bb3e233db Implement #77726: Allow null character in regex patterns
In 8b3c1a3, this was disallowed to fix #55856, which was a security
issue caused by the /e modifier. The fix that was made was the
"Easier fix" as described in the original report.

With this fix, pattern strings are no longer treated as null terminated,
so null characters can be placed inside and matched against with regex
patterns without security problems, so there is no longer a reason to
give the error. Allowing this is consistent with the behaviour of many
other languages, including JavaScript, and thanks to PCRE2[0], it does
not require manually escaping null characters. Now that we can avoid the
error here without the cost of escaping characters, there is really no
need anymore to stray here from the conventional behaviour.

Currently, null characters are still disallowed before the first
delimiter and in the options section at the end of a regex string, but
these error messages have been updated.

[0] Since PCRE2, pattern strings no longer have to be null terminated,
and raw null characters match as normal.

Closes GH-8114.
2022-06-17 19:30:44 +02:00
Christoph M. Becker 98a4ab2266 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix imagecreatefromavif() memory leak
2022-06-17 17:31:48 +02:00
Christoph M. Becker 036bed01ce Fix imagecreatefromavif() memory leak
This has been reported as https://github.com/libgd/libgd/issues/831.
We port the respective fix to our bundled libgd.

Closes GH-8812.
2022-06-17 17:30:57 +02:00
twosee 4a9c001140 Add clean_module_functions() (#8763)
Add clean_module_functions() to clean functions which are registered by zend_register_functions().
The general logic of clean_module_functions() is consistent with clean_module_classes().
2022-06-17 16:33:20 +02:00
Arnaud Le Blanc 827754ac22 Fix type (#8814) 2022-06-17 15:23:21 +02:00
Arnaud Le Blanc efc8f0ebf8 Deprecate zend_atol() / add zend_ini_parse_quantity() (#7951)
Add zend_ini_parse_quantity() and deprecate zend_atol(), zend_atoi()

zend_atol() and zend_atoi() don't just do number parsing.
They also check for a 'K', 'M', or 'G' at the end of the string,
and multiply the parsed value out accordingly.

Unfortunately, they ignore any other non-numerics between the
numeric component and the last character in the string.
This means that numbers such as the following are both valid
and non-intuitive in their final output.

* "123KMG" is interpreted as "123G" -> 132070244352
* "123G " is interpreted as "123 " -> 123
* "123GB" is interpreted as "123B" -> 123
* "123 I like tacos." is also interpreted as "123." -> 123

Currently, in php-src these functions are used only for parsing ini values.

In this change we deprecate zend_atol(), zend_atoi(), and introduce a new
function with the same behavior, but with the ability to report invalid inputs
to the caller. The function's name also makes the behavior less unexpected:
zend_ini_parse_quantity().

Co-authored-by: Sara Golemon <pollita@php.net>
2022-06-17 14:12:53 +02:00
Derick Rethans 9458f5f2c8 Merge branch 'PHP-8.1' 2022-06-17 09:36:52 +01:00
Derick Rethans 3fed226e62 Merge branch 'PHP-8.0' into PHP-8.1 2022-06-17 09:36:45 +01:00
Derick Rethans fe97a5ae19 Merge remote-tracking branch 'derickr/bug77342' into PHP-8.0 2022-06-17 09:36:10 +01:00
Derick Rethans b23dfe4986 Skip tests on 32-bit 2022-06-17 09:34:27 +01:00
Derick Rethans 36990aab8e Fixed bug #77243 (Weekdays are calculated incorrectly for negative years) 2022-06-17 09:34:27 +01:00
Derick Rethans dcb758caee Merged pull request #8807 2022-06-17 09:32:53 +01:00
Derick Rethans 2c166647f1 Fix phpize to include _GNU_SOURCE by default
This is to address the issue at
https://github.com/php/php-src/commit/067df263448ee26013cddee1065bc9c1f028bd23#commitcomment-61578732
2022-06-16 20:49:03 +01:00
Michal Prívozník a87f4dd930 check_parameters.php: Make the script's retval reflect errors
When the check_parameters.php script meets an error it prints it
out but the exit value is not affected, it's still 0. This does
not fly with projects that want to run this script as a part of
their test suite.

Therefore, make the script return 0 on success and 2 if any error
was reported.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Closes GH-8790.
2022-06-16 15:34:37 +02:00
David Carlier f25afaf9ea Merge branch 'PHP-8.1' 2022-06-16 12:44:48 +01:00
David Carlier 75743eaf1b Merge branch 'PHP-8.0' into PHP-8.1 2022-06-16 12:41:51 +01:00
Heiko Weber a83363e361 FPM: Fix use after free in fpm_evaluate_full_path
Closes #8796.
2022-06-16 12:18:01 +01:00
twosee b1223ee35f Use get_active_function_or_method_name() for zend_forbid_dynamic_call() (#8762)
A slight imperfection in https://github.com/php/php-src/pull/7443.
As a zend_API, we should also consider other extensions that may call it in methods. This change will not break the behavior of php-src.
2022-06-16 12:02:53 +01:00
Christoph M. Becker 9e9141f712 Use HTTPS URLs in resource files
Although it is unlikely that anybody ever sees these URLs, since they
are not shown in the file property sheet, it's overdue to switch to
HTTPS.
2022-06-15 17:56:14 +02:00