Skip to content

Commit 4227f15

Browse files
committed
Merge branch 'master' - merge PCRE 10.44 downgrade
2 parents 66c5bfa + 928af45 commit 4227f15

File tree

233 files changed

+13954
-20209
lines changed

Some content is hidden

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

233 files changed

+13954
-20209
lines changed

.github/scripts/windows/test_task.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ if %errorlevel% neq 0 exit /b 3
3636
rem setup PostgreSQL related exts
3737
set PGUSER=postgres
3838
set PGPASSWORD=Password12!
39-
rem set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=postgres password=Password12!
40-
echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"
39+
set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%
4140
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=%PGUSER% password=%PGPASSWORD%
4241
set TMP_POSTGRESQL_BIN=%PGBIN%
4342
"%TMP_POSTGRESQL_BIN%\createdb.exe" test

CODING_STANDARDS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ rewritten to comply with these rules.
276276

277277
1. The length of constant string literals should be calculated via ``strlen()``
278278
instead of using ``sizeof()-1`` as it is clearer and any modern compiler
279-
will optimize it away. Legacy usages of the latter style exists within the
279+
will optimize it away. Legacy usages of the latter style exist within the
280280
codebase but should not be refactored, unless larger refactoring around that
281281
code is taking place.
282282

NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ PHP NEWS
3333
. Fixed bug GH-19926 (reset internal pointer earlier while splicing array
3434
while COW violation flag is still set). (alexandre-daubois)
3535

36+
- Streams:
37+
. Added so_reuseaddr streams context socket option that allows disabling
38+
address resuse.
39+
3640
- Zip:
3741
. Fixed ZipArchive callback being called after executor has shut down.
3842
(ilutov)
43+
. Support minimum version for libzip dependency updated to 1.0.0.
44+
(David Carlier)
3945

4046
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>

UPGRADING

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ PHP 8.6 UPGRADE NOTES
3636
IntlNumberRangeFormatter::IDENTITY_FALLBACK_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY_OR_SINGLE_VALUE, IntlNumberRangeFormatter::IDENTITY_FALLBACK_APPROXIMATELY and
3737
IntlNumberRangeFormatter::IDENTITY_FALLBACK_RANGE identity fallbacks.
3838
It is supported from icu 63.
39+
40+
- Streams:
41+
. Added stream socket context option so_reuseaddr that allows disabling
42+
address reuse (SO_REUSEADDR) and explicitly uses SO_EXCLUSIVEADDRUSE on
43+
Windows.
44+
3945
========================================
4046
3. Changes in SAPI modules
4147
========================================
@@ -111,5 +117,11 @@ PHP 8.6 UPGRADE NOTES
111117
. Arguments are now passed more efficiently to known constructors (e.g. when
112118
using new self()).
113119

120+
- DOM:
121+
. Made splitText() faster and consume less memory.
122+
114123
- JSON:
115124
. Improve performance of encoding arrays and objects.
125+
126+
- Standard:
127+
. Improved performance of array_fill_keys().
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
GH-20377: Constructor promotion with a final property without visibility set
3+
--FILE--
4+
<?php
5+
6+
class Demo {
7+
public function __construct(
8+
final string $foo,
9+
final public string $bar,
10+
) {}
11+
}
12+
13+
$d = new Demo("first", "second");
14+
var_dump($d);
15+
16+
?>
17+
--EXPECTF--
18+
object(Demo)#%d (2) {
19+
["foo"]=>
20+
string(5) "first"
21+
["bar"]=>
22+
string(6) "second"
23+
}

Zend/zend_compile.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7864,6 +7864,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
78647864
}
78657865
}
78667866

7867+
const uint32_t promotion_flags = ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY | ZEND_ACC_FINAL;
78677868
for (i = 0; i < list->children; ++i) {
78687869
zend_ast *param_ast = list->child[i];
78697870
zend_ast *type_ast = param_ast->child[0];
@@ -7875,7 +7876,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
78757876
zend_string *name = zval_make_interned_string(zend_ast_get_zval(var_ast));
78767877
bool is_ref = (param_ast->attr & ZEND_PARAM_REF) != 0;
78777878
bool is_variadic = (param_ast->attr & ZEND_PARAM_VARIADIC) != 0;
7878-
uint32_t property_flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY | ZEND_ACC_FINAL);
7879+
uint32_t property_flags = param_ast->attr & promotion_flags;
78797880
bool is_promoted = property_flags || hooks_ast;
78807881

78817882
CG(zend_lineno) = param_ast->lineno;
@@ -8102,7 +8103,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
81028103
zend_ast *param_ast = list->child[i];
81038104
zend_ast *hooks_ast = param_ast->child[5];
81048105
bool is_ref = (param_ast->attr & ZEND_PARAM_REF) != 0;
8105-
uint32_t flags = param_ast->attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_PPP_SET_MASK | ZEND_ACC_READONLY);
8106+
uint32_t flags = param_ast->attr & promotion_flags;
81068107
bool is_promoted = flags || hooks_ast;
81078108
if (!is_promoted) {
81088109
continue;

Zend/zend_hash.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,17 @@ static zend_always_inline bool zend_hash_str_exists_ind(const HashTable *ht, con
473473
Z_TYPE_P(Z_INDIRECT_P(zv)) != IS_UNDEF);
474474
}
475475

476+
static zend_always_inline zval *zend_symtable_add(HashTable *ht, zend_string *key, zval *pData)
477+
{
478+
zend_ulong idx;
479+
480+
if (ZEND_HANDLE_NUMERIC(key, idx)) {
481+
return zend_hash_index_add(ht, idx, pData);
482+
} else {
483+
return zend_hash_add(ht, key, pData);
484+
}
485+
}
486+
476487
static zend_always_inline zval *zend_symtable_add_new(HashTable *ht, zend_string *key, zval *pData)
477488
{
478489
zend_ulong idx;

ext/dom/text.c

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ Modern spec URL: https://dom.spec.whatwg.org/#dom-text-splittext
9696
*/
9797
PHP_METHOD(DOMText, splitText)
9898
{
99-
zval *id;
10099
xmlChar *first;
101100
xmlChar *second;
102101
xmlNodePtr node;
@@ -105,11 +104,10 @@ PHP_METHOD(DOMText, splitText)
105104
int length;
106105
dom_object *intern;
107106

108-
id = ZEND_THIS;
109107
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &offset) == FAILURE) {
110108
RETURN_THROWS();
111109
}
112-
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
110+
DOM_GET_OBJ(node, ZEND_THIS, xmlNodePtr, intern);
113111

114112
if (offset < 0) {
115113
zend_argument_value_error(1, "must be greater than or equal to 0");
@@ -129,17 +127,18 @@ PHP_METHOD(DOMText, splitText)
129127
first = xmlUTF8Strndup(cur, (int)offset);
130128
second = xmlUTF8Strsub(cur, (int)offset, (int)(length - offset));
131129

132-
xmlNodeSetContent(node, first);
133-
nnode = xmlNewDocText(node->doc, second);
134-
135-
xmlFree(first);
136-
xmlFree(second);
130+
xmlNodeSetContent(node, NULL);
131+
node->content = first;
132+
nnode = xmlNewDocText(node->doc, NULL);
137133

138134
if (nnode == NULL) {
135+
xmlFree(second);
139136
php_dom_throw_error(INVALID_STATE_ERR, /* strict */ true);
140137
RETURN_THROWS();
141138
}
142139

140+
nnode->content = second;
141+
143142
if (node->parent != NULL) {
144143
nnode->type = XML_ELEMENT_NODE;
145144
xmlAddNextSibling(node, nnode);
@@ -155,21 +154,11 @@ Since: DOM Level 3
155154
*/
156155
PHP_METHOD(DOMText, isWhitespaceInElementContent)
157156
{
158-
zval *id;
159157
xmlNodePtr node;
160158
dom_object *intern;
161-
162-
id = ZEND_THIS;
163-
if (zend_parse_parameters_none() == FAILURE) {
164-
RETURN_THROWS();
165-
}
166-
DOM_GET_OBJ(node, id, xmlNodePtr, intern);
167-
168-
if (xmlIsBlankNode(node)) {
169-
RETURN_TRUE;
170-
} else {
171-
RETURN_FALSE;
172-
}
159+
ZEND_PARSE_PARAMETERS_NONE();
160+
DOM_GET_OBJ(node, ZEND_THIS, xmlNodePtr, intern);
161+
RETURN_BOOL(xmlIsBlankNode(node));
173162
}
174163
/* }}} end dom_text_is_whitespace_in_element_content */
175164

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,21 @@
1717
#include <config.h>
1818
#endif
1919

20+
#if __cplusplus >= 201703L
21+
#include <string_view>
22+
#include <unicode/unistr.h>
23+
#endif
24+
25+
extern "C" {
2026
#include "php_intl.h"
27+
}
2128
#include "collator_class.h"
2229
#include "collator_convert.h"
2330

2431
#include <unicode/ustring.h>
2532

2633
/* {{{ Get collation attribute value. */
27-
PHP_FUNCTION( collator_get_attribute )
34+
U_CFUNC PHP_FUNCTION( collator_get_attribute )
2835
{
2936
zend_long attribute, value;
3037

@@ -40,15 +47,15 @@ PHP_FUNCTION( collator_get_attribute )
4047
/* Fetch the object. */
4148
COLLATOR_METHOD_FETCH_OBJECT;
4249

43-
value = ucol_getAttribute( co->ucoll, attribute, COLLATOR_ERROR_CODE_P( co ) );
50+
value = ucol_getAttribute( co->ucoll, static_cast<UColAttribute>(attribute), COLLATOR_ERROR_CODE_P( co ) );
4451
COLLATOR_CHECK_STATUS( co, "Error getting attribute value" );
4552

4653
RETURN_LONG( value );
4754
}
4855
/* }}} */
4956

5057
/* {{{ Set collation attribute. */
51-
PHP_FUNCTION( collator_set_attribute )
58+
U_CFUNC PHP_FUNCTION( collator_set_attribute )
5259
{
5360
zend_long attribute, value;
5461
COLLATOR_METHOD_INIT_VARS
@@ -65,15 +72,15 @@ PHP_FUNCTION( collator_set_attribute )
6572
COLLATOR_METHOD_FETCH_OBJECT;
6673

6774
/* Set new value for the given attribute. */
68-
ucol_setAttribute( co->ucoll, attribute, value, COLLATOR_ERROR_CODE_P( co ) );
75+
ucol_setAttribute( co->ucoll, static_cast<UColAttribute>(attribute), static_cast<UColAttributeValue>(value), COLLATOR_ERROR_CODE_P( co ) );
6976
COLLATOR_CHECK_STATUS( co, "Error setting attribute value" );
7077

7178
RETURN_TRUE;
7279
}
7380
/* }}} */
7481

7582
/* {{{ Returns the current collation strength. */
76-
PHP_FUNCTION( collator_get_strength )
83+
U_CFUNC PHP_FUNCTION( collator_get_strength )
7784
{
7885
COLLATOR_METHOD_INIT_VARS
7986

@@ -93,7 +100,7 @@ PHP_FUNCTION( collator_get_strength )
93100
/* }}} */
94101

95102
/* {{{ Set the collation strength. */
96-
PHP_FUNCTION( collator_set_strength )
103+
U_CFUNC PHP_FUNCTION( collator_set_strength )
97104
{
98105
zend_long strength;
99106

@@ -110,7 +117,7 @@ PHP_FUNCTION( collator_set_strength )
110117
COLLATOR_METHOD_FETCH_OBJECT;
111118

112119
/* Set given strength. */
113-
ucol_setStrength( co->ucoll, strength );
120+
ucol_setStrength( co->ucoll, static_cast<UColAttributeValue>(strength) );
114121

115122
RETURN_TRUE;
116123
}
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@
1515

1616
#include "collator.h"
1717
#include "collator_class.h"
18+
extern "C" {
1819
#include "php_intl.h"
20+
#include "intl_error.h"
21+
#include "collator_arginfo.h"
22+
}
1923
#include "collator_sort.h"
2024
#include "collator_convert.h"
21-
#include "intl_error.h"
2225

2326
#include <unicode/ucol.h>
2427

25-
#include "collator_arginfo.h"
2628

27-
zend_class_entry *Collator_ce_ptr = NULL;
29+
zend_class_entry *Collator_ce_ptr = nullptr;
2830
static zend_object_handlers Collator_handlers;
2931

3032
/*
@@ -43,9 +45,9 @@ void Collator_objects_free(zend_object *object )
4345
/* }}} */
4446

4547
/* {{{ Collator_object_create */
46-
zend_object *Collator_object_create(zend_class_entry *ce )
48+
U_CFUNC zend_object *Collator_object_create(zend_class_entry *ce )
4749
{
48-
Collator_object *intern = zend_object_alloc(sizeof(Collator_object), ce);
50+
Collator_object *intern = reinterpret_cast<Collator_object *>(zend_object_alloc(sizeof(Collator_object), ce));
4951
intl_error_init(COLLATOR_ERROR_P(intern));
5052
zend_object_std_init(&intern->zo, ce );
5153
object_properties_init(&intern->zo, ce);
@@ -61,7 +63,7 @@ zend_object *Collator_object_create(zend_class_entry *ce )
6163
/* {{{ collator_register_Collator_symbols
6264
* Initialize 'Collator' class
6365
*/
64-
void collator_register_Collator_symbols(int module_number)
66+
U_CFUNC void collator_register_Collator_symbols(int module_number)
6567
{
6668
register_collator_symbols(module_number);
6769

@@ -75,7 +77,7 @@ void collator_register_Collator_symbols(int module_number)
7577
/* Collator has no usable clone semantics - ucol_cloneBinary/ucol_openBinary require binary buffer
7678
for which we don't have the place to keep */
7779
Collator_handlers.offset = XtOffsetOf(Collator_object, zo);
78-
Collator_handlers.clone_obj = NULL;
80+
Collator_handlers.clone_obj = nullptr;
7981
Collator_handlers.free_obj = Collator_objects_free;
8082
}
8183
/* }}} */
@@ -84,7 +86,7 @@ void collator_register_Collator_symbols(int module_number)
8486
* Initialize internals of Collator_object.
8587
* Must be called before any other call to 'collator_object_...' functions.
8688
*/
87-
void collator_object_init( Collator_object* co )
89+
U_CFUNC void collator_object_init( Collator_object* co )
8890
{
8991
if( !co )
9092
return;
@@ -96,15 +98,15 @@ void collator_object_init( Collator_object* co )
9698
/* {{{ void collator_object_destroy( Collator_object* co )
9799
* Clean up mem allocted by internals of Collator_object
98100
*/
99-
void collator_object_destroy( Collator_object* co )
101+
U_CFUNC void collator_object_destroy( Collator_object* co )
100102
{
101103
if( !co )
102104
return;
103105

104106
if( co->ucoll )
105107
{
106108
ucol_close( co->ucoll );
107-
co->ucoll = NULL;
109+
co->ucoll = nullptr;
108110
}
109111

110112
intl_error_reset( COLLATOR_ERROR_P( co ) );

0 commit comments

Comments
 (0)