Skip to content

Commit aaff3fa

Browse files
Merge branch 'php:master' into master
2 parents 80aa081 + db6840b commit aaff3fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+484
-85
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--------------------------------------------------------------------
22
The PHP License, version 3.01
3-
Copyright (c) 1999 - 2022 The PHP Group. All rights reserved.
3+
Copyright (c) 1999 - 2023 The PHP Group. All rights reserved.
44
--------------------------------------------------------------------
55

66
Redistribution and use in source and binary forms, with or without

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ PHP NEWS
5151
casing rules for the Greek letter sigma. For mb_convert_case, conditional
5252
casing only applies to MB_CASE_LOWER and MB_CASE_TITLE modes, not to
5353
MB_CASE_LOWER_SIMPLE and MB_CASE_TITLE_SIMPLE. (Alex Dowad)
54+
. mb_detect_encoding is better able to identify UTF-8 and UTF-16 strings
55+
with a byte-order mark. (Alex Dowad)
5456

5557
- Opcache:
5658
. Added start, restart and force restart time to opcache's
@@ -96,4 +98,7 @@ PHP NEWS
9698
. Fixed bug #51056: blocking fread() will block even if data is available.
9799
(Jakub Zelenka)
98100

101+
- XSLTProcessor:
102+
. Fixed bug #69168 (DomNode::getNodePath() returns invalid path). (nielsdos)
103+
99104
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ PHP 8.3 UPGRADE NOTES
6565
- Standard:
6666
. E_NOTICEs emitted by unserialized() have been promoted to E_WARNING.
6767
RFC: https://wiki.php.net/rfc/improve_unserialize_error_handling
68+
. array_pad() is now only limited by the maximum number of elements an array
69+
can have. Before, it was only possible to add at most 1048576 elements at a
70+
time.
6871

6972
========================================
7073
6. New Functions

Zend/zend_operators.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ static _locale_t current_locale = NULL;
6060
/* Common code for SSE2 accelerated character case conversion */
6161

6262
#define BLOCKCONV_INIT_RANGE(start, end) \
63-
const __m128i blconv_start_minus_1 = _mm_set1_epi8((start) - 1); \
64-
const __m128i blconv_end_plus_1 = _mm_set1_epi8((end) + 1);
63+
const __m128i blconv_offset = _mm_set1_epi8((signed char)(SCHAR_MIN - start)); \
64+
const __m128i blconv_threshold = _mm_set1_epi8(SCHAR_MIN + (end - start) + 1);
6565

6666
#define BLOCKCONV_STRIDE sizeof(__m128i)
6767

@@ -70,14 +70,12 @@ static _locale_t current_locale = NULL;
7070

7171
#define BLOCKCONV_LOAD(input) \
7272
__m128i blconv_operand = _mm_loadu_si128((__m128i*)(input)); \
73-
__m128i blconv_gt = _mm_cmpgt_epi8(blconv_operand, blconv_start_minus_1); \
74-
__m128i blconv_lt = _mm_cmplt_epi8(blconv_operand, blconv_end_plus_1); \
75-
__m128i blconv_mingle = _mm_and_si128(blconv_gt, blconv_lt);
73+
__m128i blconv_mask = _mm_cmplt_epi8(_mm_add_epi8(blconv_operand, blconv_offset), blconv_threshold);
7674

77-
#define BLOCKCONV_FOUND() _mm_movemask_epi8(blconv_mingle)
75+
#define BLOCKCONV_FOUND() _mm_movemask_epi8(blconv_mask)
7876

7977
#define BLOCKCONV_STORE(dest) \
80-
__m128i blconv_add = _mm_and_si128(blconv_mingle, blconv_delta); \
78+
__m128i blconv_add = _mm_and_si128(blconv_mask, blconv_delta); \
8179
__m128i blconv_result = _mm_add_epi8(blconv_operand, blconv_add); \
8280
_mm_storeu_si128((__m128i *)(dest), blconv_result);
8381

Zend/zend_vm_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,6 +2130,7 @@ ZEND_VM_C_LABEL(fetch_obj_r_fast_copy):
21302130
#if ZEND_DEBUG
21312131
if (!EG(exception) && prop_info && prop_info != ZEND_WRONG_PROPERTY_INFO
21322132
&& ZEND_TYPE_IS_SET(prop_info->type)) {
2133+
ZVAL_OPT_DEREF(retval);
21332134
zend_verify_property_type(prop_info, retval, /* strict */ true);
21342135
}
21352136
#endif

Zend/zend_vm_execute.h

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/date/lib/timelib.h

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,31 @@
3030
# include "timelib_config.h"
3131
#endif
3232

33-
#define TIMELIB_VERSION 202203
34-
#define TIMELIB_EXTENDED_VERSION 20220301
35-
#define TIMELIB_ASCII_VERSION "2022.03"
33+
#define TIMELIB_VERSION 202204
34+
#define TIMELIB_EXTENDED_VERSION 20220401
35+
#define TIMELIB_ASCII_VERSION "2022.04"
3636

3737
#include <stdlib.h>
3838
#include <stdbool.h>
3939
#include <limits.h>
4040
#include <inttypes.h>
4141

42+
# ifndef HAVE_INT32_T
43+
# if SIZEOF_INT == 4
44+
typedef int int32_t;
45+
# elif SIZEOF_LONG == 4
46+
typedef long int int32_t;
47+
# endif
48+
# endif
49+
50+
# ifndef HAVE_UINT32_T
51+
# if SIZEOF_INT == 4
52+
typedef unsigned int uint32_t;
53+
# elif SIZEOF_LONG == 4
54+
typedef unsigned long int uint32_t;
55+
# endif
56+
# endif
57+
4258
#ifdef _WIN32
4359
# if _MSC_VER >= 1600
4460
# include <stdint.h>

ext/ffi/ffi.stub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ final class FFI
1010
/**
1111
* @var int
1212
* @cvalue __BIGGEST_ALIGNMENT__
13+
* @link ffi-ffi.constants.biggest-alignment
1314
*/
1415
public const __BIGGEST_ALIGNMENT__ = UNKNOWN;
1516

ext/ffi/ffi_arginfo.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/gmp/gmp.c

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,26 @@ static inline void _gmp_unary_opl(INTERNAL_FUNCTION_PARAMETERS, gmp_unary_opl_t
862862
}
863863
/* }}} */
864864

865+
static bool gmp_verify_base(zend_long base, uint32_t arg_num)
866+
{
867+
if (base && (base < 2 || base > GMP_MAX_BASE)) {
868+
zend_argument_value_error(arg_num, "must be between 2 and %d", GMP_MAX_BASE);
869+
return false;
870+
}
871+
872+
return true;
873+
}
874+
875+
static zend_result gmp_initialize_number(mpz_ptr gmp_number, const zend_string *arg_str, zend_long arg_l, zend_long base)
876+
{
877+
if (arg_str) {
878+
return convert_zstr_to_gmp(gmp_number, arg_str, base, 1);
879+
}
880+
881+
mpz_set_si(gmp_number, arg_l);
882+
return SUCCESS;
883+
}
884+
865885
/* {{{ Initializes GMP number */
866886
ZEND_FUNCTION(gmp_init)
867887
{
@@ -876,18 +896,14 @@ ZEND_FUNCTION(gmp_init)
876896
Z_PARAM_LONG(base)
877897
ZEND_PARSE_PARAMETERS_END();
878898

879-
if (base && (base < 2 || base > GMP_MAX_BASE)) {
880-
zend_argument_value_error(2, "must be between 2 and %d", GMP_MAX_BASE);
899+
if (!gmp_verify_base(base, 2)) {
881900
RETURN_THROWS();
882901
}
883902

884903
INIT_GMP_RETVAL(gmp_number);
885-
if (arg_str) {
886-
if (convert_zstr_to_gmp(gmp_number, arg_str, base, 1) == FAILURE) {
887-
RETURN_THROWS();
888-
}
889-
} else {
890-
mpz_set_si(gmp_number, arg_l);
904+
905+
if (gmp_initialize_number(gmp_number, arg_str, arg_l, base) == FAILURE) {
906+
RETURN_THROWS();
891907
}
892908
}
893909
/* }}} */
@@ -2021,6 +2037,30 @@ ZEND_FUNCTION(gmp_scan1)
20212037
}
20222038
/* }}} */
20232039

2040+
ZEND_METHOD(GMP, __construct)
2041+
{
2042+
zend_string *arg_str = NULL;
2043+
zend_long arg_l = 0;
2044+
zend_long base = 0;
2045+
2046+
ZEND_PARSE_PARAMETERS_START(0, 2)
2047+
Z_PARAM_OPTIONAL
2048+
Z_PARAM_STR_OR_LONG(arg_str, arg_l)
2049+
Z_PARAM_LONG(base)
2050+
ZEND_PARSE_PARAMETERS_END();
2051+
2052+
if (!gmp_verify_base(base, 2)) {
2053+
RETURN_THROWS();
2054+
}
2055+
2056+
return_value = ZEND_THIS;
2057+
mpz_ptr gmp_number = GET_GMP_FROM_ZVAL(ZEND_THIS);
2058+
2059+
if (gmp_initialize_number(gmp_number, arg_str, arg_l, base) == FAILURE) {
2060+
RETURN_THROWS();
2061+
}
2062+
}
2063+
20242064
ZEND_METHOD(GMP, __serialize)
20252065
{
20262066
ZEND_PARSE_PARAMETERS_NONE();

ext/gmp/gmp.stub.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959

6060
class GMP
6161
{
62+
public function __construct(int|string $num = 0, int $base = 0) {}
63+
6264
public function __serialize(): array {}
6365

6466
public function __unserialize(array $data): void {}

ext/gmp/gmp_arginfo.h

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/gmp/tests/construct.phpt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--TEST--
2+
Constructor for GMP
3+
--EXTENSIONS--
4+
gmp
5+
--FILE--
6+
<?php
7+
var_dump(new GMP);
8+
var_dump(new GMP(0));
9+
var_dump(new GMP(123));
10+
var_dump(new GMP("0xAA"));
11+
var_dump(new GMP("12", 4));
12+
try {
13+
var_dump(new GMP("12", 999));
14+
} catch (ValueError $e) {
15+
echo $e->getMessage() . "\n";
16+
}
17+
try {
18+
var_dump(new GMP("", 10));
19+
} catch (ValueError $e) {
20+
echo $e->getMessage() . "\n";
21+
}
22+
try {
23+
var_dump(new GMP("hello"));
24+
} catch (ValueError $e) {
25+
echo $e->getMessage() . "\n";
26+
}
27+
?>
28+
--EXPECT--
29+
object(GMP)#1 (1) {
30+
["num"]=>
31+
string(1) "0"
32+
}
33+
object(GMP)#1 (1) {
34+
["num"]=>
35+
string(1) "0"
36+
}
37+
object(GMP)#1 (1) {
38+
["num"]=>
39+
string(3) "123"
40+
}
41+
object(GMP)#1 (1) {
42+
["num"]=>
43+
string(3) "170"
44+
}
45+
object(GMP)#1 (1) {
46+
["num"]=>
47+
string(1) "6"
48+
}
49+
GMP::__construct(): Argument #2 ($base) must be between 2 and 62
50+
GMP::__construct(): Argument #1 ($num) is not an integer string
51+
GMP::__construct(): Argument #1 ($num) is not an integer string

0 commit comments

Comments
 (0)