Skip to content

Commit 3ec55d6

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Clarify that preg_match_all() cannot return null
2 parents 279d6a4 + bc6ec0a commit 3ec55d6

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

ext/pcre/php_pcre.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str,
12061206
if (subpats != NULL) {
12071207
subpats = zend_try_array_init(subpats);
12081208
if (!subpats) {
1209-
return;
1209+
RETURN_THROWS();
12101210
}
12111211
}
12121212

ext/pcre/php_pcre.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
function preg_match(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}
77

88
/** @param array $matches */
9-
function preg_match_all(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false|null {}
9+
function preg_match_all(string $pattern, string $subject, &$matches = null, int $flags = 0, int $offset = 0): int|false {}
1010

1111
/**
1212
* @param int $count

ext/pcre/php_pcre_arginfo.h

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 62ab532c890b5421bfe8b784c803829cf71a1423 */
2+
* Stub hash: bc6f31ac17d4f5d1a60dd3dad5f671058f40a224 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
@@ -9,13 +9,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match, 0, 2, MAY_BE_LONG|MA
99
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
1010
ZEND_END_ARG_INFO()
1111

12-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_match_all, 0, 2, MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_NULL)
13-
ZEND_ARG_TYPE_INFO(0, pattern, IS_STRING, 0)
14-
ZEND_ARG_TYPE_INFO(0, subject, IS_STRING, 0)
15-
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(1, matches, "null")
16-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
17-
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, offset, IS_LONG, 0, "0")
18-
ZEND_END_ARG_INFO()
12+
#define arginfo_preg_match_all arginfo_preg_match
1913

2014
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_preg_replace, 0, 3, MAY_BE_STRING|MAY_BE_ARRAY|MAY_BE_NULL)
2115
ZEND_ARG_TYPE_MASK(0, pattern, MAY_BE_STRING|MAY_BE_ARRAY, NULL)

0 commit comments

Comments
 (0)