Skip to content

Commit bd03c03

Browse files
mvoriseknielsdos
authored andcommitted
Allow CTE on more CTE safe functions (php#10771)
1 parent 727e26f commit bd03c03

7 files changed

+175
-62
lines changed

ext/hash/hash.stub.php

+2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ function hash_copy(HashContext $context): HashContext {}
4545

4646
/**
4747
* @return array<int, string>
48+
* @compile-time-eval
4849
* @refcount 1
4950
*/
5051
function hash_algos(): array {}
5152

5253
/**
5354
* @return array<int, string>
55+
* @compile-time-eval
5456
* @refcount 1
5557
*/
5658
function hash_hmac_algos(): array {}

ext/hash/hash_arginfo.h

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/standard/basic_functions.stub.php

+128-20
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,9 @@ function array_unshift(array &$array, mixed ...$values): int {}
16601660

16611661
function array_splice(array &$array, int $offset, ?int $length = null, mixed $replacement = []): array {}
16621662

1663+
/**
1664+
* @compile-time-eval
1665+
*/
16631666
function array_slice(array $array, int $offset, ?int $length = null, bool $preserve_keys = false): array {}
16641667

16651668
/**
@@ -1708,14 +1711,21 @@ function array_values(array $array): array {}
17081711

17091712
/**
17101713
* @return array<int|string, int>
1714+
* @compile-time-eval
17111715
* @refcount 1
17121716
*/
17131717
function array_count_values(array $array): array {}
17141718

1715-
/** @refcount 1 */
1719+
/**
1720+
* @compile-time-eval
1721+
* @refcount 1
1722+
*/
17161723
function array_column(array $array, int|string|null $column_key, int|string|null $index_key = null): array {}
17171724

1718-
/** @refcount 1 */
1725+
/**
1726+
* @compile-time-eval
1727+
* @refcount 1
1728+
*/
17191729
function array_reverse(array $array, bool $preserve_keys = false): array {}
17201730

17211731
function array_pad(array $array, int $length, mixed $value): array {}
@@ -1844,8 +1854,14 @@ function array_multisort(&$array, &...$rest): bool {}
18441854
/** @return int|string|array<int, int|string> */
18451855
function array_rand(array $array, int $num = 1): int|string|array {}
18461856

1857+
/**
1858+
* @compile-time-eval
1859+
*/
18471860
function array_sum(array $array): int|float {}
18481861

1862+
/**
1863+
* @compile-time-eval
1864+
*/
18491865
function array_product(array $array): int|float {}
18501866

18511867
function array_reduce(array $array, callable $callback, mixed $initial = null): mixed {}
@@ -1866,8 +1882,14 @@ function array_key_exists($key, array $array): bool {}
18661882
*/
18671883
function key_exists($key, array $array): bool {}
18681884

1885+
/**
1886+
* @compile-time-eval
1887+
*/
18691888
function array_chunk(array $array, int $length, bool $preserve_keys = false): array {}
18701889

1890+
/**
1891+
* @compile-time-eval
1892+
*/
18711893
function array_combine(array $keys, array $values): array {}
18721894

18731895
/** @compile-time-eval */
@@ -2033,6 +2055,7 @@ function parse_ini_file(string $filename, bool $process_sections = false, int $s
20332055

20342056
/**
20352057
* @return array<int|string, bool|int|float|string|array|null>|false
2058+
* @compile-time-eval
20362059
* @refcount 1
20372060
*/
20382061
function parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false {}
@@ -2261,8 +2284,14 @@ function bin2hex(string $string): string {}
22612284
*/
22622285
function hex2bin(string $string): string|false {}
22632286

2287+
/**
2288+
* @compile-time-eval
2289+
*/
22642290
function strspn(string $string, string $characters, int $offset = 0, ?int $length = null): int {}
22652291

2292+
/**
2293+
* @compile-time-eval
2294+
*/
22662295
function strcspn(string $string, string $characters, int $offset = 0, ?int $length = null): int {}
22672296

22682297
#ifdef HAVE_NL_LANGINFO
@@ -2284,7 +2313,10 @@ function chop(string $string, string $characters = " \n\r\t\v\0"): string {}
22842313
/** @compile-time-eval */
22852314
function ltrim(string $string, string $characters = " \n\r\t\v\0"): string {}
22862315

2287-
/** @refcount 1 */
2316+
/**
2317+
* @compile-time-eval
2318+
* @refcount 1
2319+
*/
22882320
function wordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false): string {}
22892321

22902322
/**
@@ -2302,7 +2334,10 @@ function implode(string|array $separator, ?array $array = null): string {}
23022334
/** @alias implode */
23032335
function join(string|array $separator, ?array $array = null): string {}
23042336

2305-
/** @refcount 1 */
2337+
/**
2338+
* @compile-time-eval
2339+
* @refcount 1
2340+
*/
23062341
function strtok(string $string, ?string $token = null): string|false {}
23072342

23082343
/** @compile-time-eval */
@@ -2323,7 +2358,10 @@ function dirname(string $path, int $levels = 1): string {}
23232358
*/
23242359
function pathinfo(string $path, int $flags = PATHINFO_ALL): array|string {}
23252360

2326-
/** @refcount 1 */
2361+
/**
2362+
* @compile-time-eval
2363+
* @refcount 1
2364+
*/
23272365
function stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}
23282366

23292367
/**
@@ -2347,7 +2385,10 @@ function strrpos(string $haystack, string $needle, int $offset = 0): int|false {
23472385
/** @compile-time-eval */
23482386
function strripos(string $haystack, string $needle, int $offset = 0): int|false {}
23492387

2350-
/** @refcount 1 */
2388+
/**
2389+
* @compile-time-eval
2390+
* @refcount 1
2391+
*/
23512392
function strrchr(string $haystack, string $needle): string|false {}
23522393

23532394
/** @compile-time-eval */
@@ -2359,16 +2400,25 @@ function str_starts_with(string $haystack, string $needle): bool {}
23592400
/** @compile-time-eval */
23602401
function str_ends_with(string $haystack, string $needle): bool {}
23612402

2362-
/** @refcount 1 */
2403+
/**
2404+
* @compile-time-eval
2405+
* @refcount 1
2406+
*/
23632407
function chunk_split(string $string, int $length = 76, string $separator = "\r\n"): string {}
23642408

23652409
/** @compile-time-eval */
23662410
function substr(string $string, int $offset, ?int $length = null): string {}
23672411

2368-
/** @return string|array<int|string, string> */
2412+
/**
2413+
* @return string|array<int|string, string>
2414+
* @compile-time-eval
2415+
*/
23692416
function substr_replace(array|string $string, array|string $replace, array|int $offset, array|int|null $length = null): string|array {}
23702417

2371-
/** @refcount 1 */
2418+
/**
2419+
* @compile-time-eval
2420+
* @refcount 1
2421+
*/
23722422
function quotemeta(string $string): string {}
23732423

23742424
/** @compile-time-eval */
@@ -2392,6 +2442,9 @@ function lcfirst(string $string): string {}
23922442
*/
23932443
function ucwords(string $string, string $separators = " \t\r\n\f\v"): string {}
23942444

2445+
/**
2446+
* @compile-time-eval
2447+
*/
23952448
function strtr(string $string, string|array $from, ?string $to = null): string {}
23962449

23972450
/**
@@ -2403,14 +2456,26 @@ function strrev(string $string): string {}
24032456
/** @param float $percent */
24042457
function similar_text(string $string1, string $string2, &$percent = null): int {}
24052458

2459+
/**
2460+
* @compile-time-eval
2461+
*/
24062462
function addcslashes(string $string, string $characters): string {}
24072463

2464+
/**
2465+
* @compile-time-eval
2466+
*/
24082467
function addslashes(string $string): string {}
24092468

2410-
/** @refcount 1 */
2469+
/**
2470+
* @compile-time-eval
2471+
* @refcount 1
2472+
*/
24112473
function stripcslashes(string $string): string {}
24122474

2413-
/** @refcount 1 */
2475+
/**
2476+
* @compile-time-eval
2477+
* @refcount 1
2478+
*/
24142479
function stripslashes(string $string): string {}
24152480

24162481
/**
@@ -2430,9 +2495,15 @@ function str_ireplace(array|string $search, array|string $replace, string|array
24302495
/** @refcount 1 */
24312496
function hebrev(string $string, int $max_chars_per_line = 0): string {}
24322497

2498+
/**
2499+
* @compile-time-eval
2500+
*/
24332501
function nl2br(string $string, bool $use_xhtml = true): string {}
24342502

2435-
/** @refcount 1 */
2503+
/**
2504+
* @compile-time-eval
2505+
* @refcount 1
2506+
*/
24362507
function strip_tags(string $string, array|string|null $allowed_tags = null): string {}
24372508

24382509
/**
@@ -2455,6 +2526,7 @@ function str_repeat(string $string, int $times): string {}
24552526

24562527
/**
24572528
* @return array<int, int>|string
2529+
* @compile-time-eval
24582530
* @refcount 1
24592531
*/
24602532
function count_chars(string $string, int $mode = 0): array|string {}
@@ -2469,6 +2541,9 @@ function localeconv(): array {}
24692541

24702542
function strnatcasecmp(string $string1, string $string2): int {}
24712543

2544+
/**
2545+
* @compile-time-eval
2546+
*/
24722547
function substr_count(string $haystack, string $needle, int $offset = 0, ?int $length = null): int {}
24732548

24742549
function str_pad(string $string, int $length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT): string {}
@@ -2479,7 +2554,10 @@ function str_pad(string $string, int $length, string $pad_string = " ", int $pad
24792554
*/
24802555
function sscanf(string $string, string $format, mixed &...$vars): array|int|null {}
24812556

2482-
/** @refcount 1 */
2557+
/**
2558+
* @compile-time-eval
2559+
* @refcount 1
2560+
*/
24832561
function str_rot13(string $string): string {}
24842562

24852563
/** @refcount 1 */
@@ -2497,18 +2575,26 @@ function str_word_count(string $string, int $format = 0, ?string $characters = n
24972575
*/
24982576
function str_split(string $string, int $length = 1): array {}
24992577

2500-
/** @refcount 1 */
2578+
/**
2579+
* @compile-time-eval
2580+
* @refcount 1
2581+
*/
25012582
function strpbrk(string $string, string $characters): string|false {}
25022583

2584+
/**
2585+
* @compile-time-eval
2586+
*/
25032587
function substr_compare(string $haystack, string $needle, int $offset, ?int $length = null, bool $case_insensitive = false): int {}
25042588

25052589
/**
2590+
* @compile-time-eval
25062591
* @refcount 1
25072592
* @deprecated
25082593
*/
25092594
function utf8_encode(string $string): string {}
25102595

25112596
/**
2597+
* @compile-time-eval
25122598
* @refcount 1
25132599
* @deprecated
25142600
*/
@@ -2883,10 +2969,16 @@ function http_build_query(array|object $data, string $numeric_prefix = "", ?stri
28832969

28842970
/* image.c */
28852971

2886-
/** @refcount 1 */
2972+
/**
2973+
* @compile-time-eval
2974+
* @refcount 1
2975+
*/
28872976
function image_type_to_mime_type(int $image_type): string {}
28882977

2889-
/** @refcount 1 */
2978+
/**
2979+
* @compile-time-eval
2980+
* @refcount 1
2981+
*/
28902982
function image_type_to_extension(int $image_type, bool $include_dot = true): string|false {}
28912983

28922984
/**
@@ -3165,6 +3257,9 @@ function password_needs_rehash(string $hash, string|int|null $algo, array $optio
31653257

31663258
function password_verify(#[\SensitiveParameter] string $password, string $hash): bool {}
31673259

3260+
/**
3261+
* @compile-time-eval
3262+
*/
31683263
function password_algos(): array {}
31693264

31703265
/* proc_open.c */
@@ -3193,10 +3288,16 @@ function proc_get_status($process): array {}
31933288

31943289
/* quot_print.c */
31953290

3196-
/** @refcount 1 */
3291+
/**
3292+
* @compile-time-eval
3293+
* @refcount 1
3294+
*/
31973295
function quoted_printable_decode(string $string): string {}
31983296

3199-
/** @refcount 1 */
3297+
/**
3298+
* @compile-time-eval
3299+
* @refcount 1
3300+
*/
32003301
function quoted_printable_encode(string $string): string {}
32013302

32023303
/* soundex.c */
@@ -3527,6 +3628,7 @@ function uniqid(string $prefix = "", bool $more_entropy = false): string {}
35273628

35283629
/**
35293630
* @return int|string|array<string, int|string>|null|false
3631+
* @compile-time-eval
35303632
* @refcount 1
35313633
*/
35323634
function parse_url(string $url, int $component = -1): int|string|array|null|false {}
@@ -3592,10 +3694,16 @@ function stream_filter_register(string $filter_name, string $class): bool {}
35923694

35933695
/* uuencode.c */
35943696

3595-
/** @refcount 1 */
3697+
/**
3698+
* @compile-time-eval
3699+
* @refcount 1
3700+
*/
35963701
function convert_uuencode(string $string): string {}
35973702

3598-
/** @refcount 1 */
3703+
/**
3704+
* @compile-time-eval
3705+
* @refcount 1
3706+
*/
35993707
function convert_uudecode(string $string): string|false {}
36003708

36013709
/* var.c */

0 commit comments

Comments
 (0)