diff --git a/NEWS b/NEWS index dc91f999fb15e..14667511d6651 100644 --- a/NEWS +++ b/NEWS @@ -96,6 +96,8 @@ PHP NEWS - PCRE: . Upgraded to pre2lib from 10.44 to 10.45. (nielsdos) + . Remove PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK from pcre compile options. + (mvorisek) - PDO_PGSQL: . Added Iterable support for PDO::pgsqlCopyFromArray. (KentarouTakeda) diff --git a/UPGRADING b/UPGRADING index 1a525f22f4411..542513a16402b 100644 --- a/UPGRADING +++ b/UPGRADING @@ -59,6 +59,11 @@ PHP 8.5 UPGRADE NOTES . pcntl_exec() now throws ValueErrors when entries or keys of the $env_vars parameter contain null bytes. +- PCRE: + . The extension is compiled without semi-deprecated + PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK compile option. + https://github.com/PCRE2Project/pcre2/issues/736#issuecomment-2754024651 + - PDO: . The constructor arguments set in conjunction with PDO::FETCH_CLASS now follow the usual CUFA (call_user_func_array) semantics. diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 076d2b8bbc2dd..5faa7285763ad 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -2451,17 +2451,9 @@ ZEND_API zend_result zend_std_get_closure(zend_object *obj, zend_class_entry **c return FAILURE; } *fptr_ptr = Z_FUNC_P(func); - *ce_ptr = ce; - if ((*fptr_ptr)->common.fn_flags & ZEND_ACC_STATIC) { - if (obj_ptr) { - *obj_ptr = NULL; - } - } else { - if (obj_ptr) { - *obj_ptr = obj; - } - } + *obj_ptr = obj; + return SUCCESS; } /* }}} */ diff --git a/build/Makefile.global b/build/Makefile.global index b88e19f7cc5b1..32605a203e188 100644 --- a/build/Makefile.global +++ b/build/Makefile.global @@ -89,7 +89,7 @@ PHP_TEST_SHARED_EXTENSIONS = ` \ . $$i; $(top_srcdir)/build/shtool echo -n -- " -d zend_extension=$(top_builddir)/modules/$$dlname"; \ done; \ fi` -PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*=' +PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?|session\.sid_(length|bits_per_character))[\t\ ]*=' test: all @if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ diff --git a/ext/intl/tests/dateformat_format_references.phpt b/ext/intl/tests/dateformat_format_references.phpt index da1a52955f121..576d901edeb82 100644 --- a/ext/intl/tests/dateformat_format_references.phpt +++ b/ext/intl/tests/dateformat_format_references.phpt @@ -1,5 +1,7 @@ --TEST-- Fix dateformat_format() with array argument with values as references. +--EXTENSIONS-- +intl --SKIPIF-- --EXPECTF-- +Warning: preg_split(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 9 in %s on line %d bool(false) -Warning: preg_match(): Get subpatterns list failed in %s on line %d -array(0) { -} +Warning: preg_match(): Compilation failed: \K is not allowed in lookarounds (but see PCRE2_EXTRA_ALLOW_LOOKAROUND_BSK) at offset 12 in %s on line %d +NULL diff --git a/ext/pcre/tests/bug70345_old.phpt b/ext/pcre/tests/bug70345_old.phpt new file mode 100644 index 0000000000000..ea455a59330d4 --- /dev/null +++ b/ext/pcre/tests/bug70345_old.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #70345 (Multiple vulnerabilities related to PCRE functions) +--SKIPIF-- += 38) { + die("skip new pcre version"); +} +--FILE-- + +--EXPECTF-- +bool(false) + +Warning: preg_match(): Get subpatterns list failed in %s on line %d +array(0) { +} diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 5fc4bd6b643b5..b53b7b97c9bc9 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2671,7 +2671,7 @@ ZEND_METHOD(ReflectionParameter, __toString) /* }}} */ -/* {{{ Returns this parameters's name */ +/* {{{ Returns this parameter's name */ ZEND_METHOD(ReflectionParameter, getName) { reflection_object *intern; diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 99e6983b0ffc0..dc32045ba0ff9 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -278,7 +278,6 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z { spl_fixedarray_object *intern; zend_class_entry *parent = class_type; - bool inherited = false; intern = zend_object_alloc(sizeof(spl_fixedarray_object), parent); @@ -290,21 +289,10 @@ static zend_object *spl_fixedarray_object_new_ex(zend_class_entry *class_type, z spl_fixedarray_copy_ctor(&intern->array, &other->array); } - while (parent) { - if (parent == spl_ce_SplFixedArray) { - break; - } - - parent = parent->parent; - inherited = true; - } - - ZEND_ASSERT(parent); - - if (UNEXPECTED(inherited)) { + if (UNEXPECTED(class_type != spl_ce_SplFixedArray)) { /* Find count() method */ zend_function *fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT)); - if (fptr_count->common.scope == parent) { + if (fptr_count->common.scope == spl_ce_SplFixedArray) { fptr_count = NULL; } intern->fptr_count = fptr_count; @@ -377,7 +365,7 @@ static zval *spl_fixedarray_object_read_dimension_helper(spl_fixedarray_object * { /* we have to return NULL on error here to avoid memleak because of * ZE duplicating uninitialized_zval_ptr */ - if (!offset) { + if (UNEXPECTED(!offset)) { zend_throw_error(NULL, "[] operator not supported for SplFixedArray"); return NULL; } @@ -422,7 +410,7 @@ static zval *spl_fixedarray_object_read_dimension(zend_object *object, zval *off static void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object *intern, zval *offset, zval *value) { - if (!offset) { + if (UNEXPECTED(!offset)) { /* '$array[] = value' syntax is not supported */ zend_throw_error(NULL, "[] operator not supported for SplFixedArray"); return; @@ -438,10 +426,10 @@ static void spl_fixedarray_object_write_dimension_helper(spl_fixedarray_object * } else { /* Fix #81429 */ zval *ptr = &(intern->array.elements[index]); - zval tmp; - ZVAL_COPY_VALUE(&tmp, ptr); - ZVAL_COPY_DEREF(ptr, value); - zval_ptr_dtor(&tmp); + /* This should be guaranteed by the VM handler or argument parsing. */ + ZEND_ASSERT(Z_TYPE_P(value) != IS_REFERENCE); + Z_TRY_ADDREF_P(value); + zend_safe_assign_to_variable_noref(ptr, value); } } @@ -472,10 +460,9 @@ static void spl_fixedarray_object_unset_dimension_helper(spl_fixedarray_object * if (UNEXPECTED(index >= intern->array.size)) { zend_throw_exception(spl_ce_OutOfBoundsException, "Index invalid or out of range", 0); } else { - zval garbage; - ZVAL_COPY_VALUE(&garbage, &intern->array.elements[index]); - ZVAL_NULL(&intern->array.elements[index]); - zval_ptr_dtor(&garbage); + zval null = {0}; + ZVAL_NULL(&null); + zend_safe_assign_to_variable_noref(&intern->array.elements[index], &null); } }