Skip to content

Allow CTE on more CTE safe functions #10771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8537cff
Fix #7780, some CTE functions were removed by a mistake
mvorisek Mar 3, 2023
51f5cb6
Merge branch 'fix_cte_stub'
mvorisek Mar 3, 2023
feba3e4
ctype_* functions
mvorisek Mar 4, 2023
c6c4f21
zlib_* string functions
mvorisek Mar 4, 2023
49f9a89
tokenizer functions
mvorisek Mar 4, 2023
f16c3e1
hash function
mvorisek Mar 4, 2023
0f56de5
CTE safe basic functions
mvorisek Mar 4, 2023
8e31c3e
adjust observer tests
mvorisek Mar 4, 2023
f357a7b
never evaluate hash_equals at compile time
mvorisek Mar 4, 2023
5bed8e6
ctype_lower/ctype_upper is locale dependent
mvorisek Mar 4, 2023
7b26cff
tokenizer returns array of objects
mvorisek Mar 4, 2023
d2ef625
revert some unsafe
mvorisek Mar 4, 2023
11ec828
Revert "adjust observer tests"
mvorisek Mar 4, 2023
59cf585
replace array_sum with array_reduce on observer tests
mvorisek Mar 4, 2023
745d491
fix phpdoc order for consistency
mvorisek Mar 6, 2023
dca71d9
add xfail
mvorisek Mar 6, 2023
6ef8fd1
hash can be slow, do not evaluate it as CTE
mvorisek Mar 7, 2023
16cb160
sprintf functions are locale dependent
mvorisek Mar 7, 2023
0555541
remove crypt, it can be slow
mvorisek Mar 7, 2023
a2a86c8
remove strptime as CTEable, it depends on locale
mvorisek Mar 8, 2023
8525ece
Merge branch 'master'
mvorisek Mar 8, 2023
e0652de
Merge branch 'master'
mvorisek Mar 10, 2023
d0de618
Revert "ctype functions"
mvorisek Mar 13, 2023
1226548
Remove CTE flag from array_diff_ukey(), which was added by mistake
mvorisek Mar 15, 2023
86b0bc4
Merge branch 'master'
mvorisek Apr 24, 2023
8d347ed
Revert "zlib_* string functions" - compress can be slow
mvorisek Mar 4, 2023
17a3718
Merge remote-tracking branch 'origin/master' into more_cte
mvorisek May 11, 2023
ff9b2ba
rm long2ip family
mvorisek May 11, 2023
4e764fe
remove all other unwanted
mvorisek May 12, 2023
aeddb82
strnatcasecmp is not locale safe too
mvorisek May 12, 2023
6bb8a2f
xfail deoptimized test with opcache only
mvorisek May 12, 2023
13b0fd6
rm more locale dependent functions
mvorisek May 12, 2023
8f4e5af
fix xfail
mvorisek May 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ext/hash/hash.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ function hash_copy(HashContext $context): HashContext {}

/**
* @return array<int, string>
* @compile-time-eval
* @refcount 1
*/
function hash_algos(): array {}

/**
* @return array<int, string>
* @compile-time-eval
* @refcount 1
*/
function hash_hmac_algos(): array {}
Expand Down
6 changes: 3 additions & 3 deletions ext/hash/hash_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

148 changes: 128 additions & 20 deletions ext/standard/basic_functions.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,9 @@ function array_unshift(array &$array, mixed ...$values): int {}

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

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

/**
Expand Down Expand Up @@ -1708,14 +1711,21 @@ function array_values(array $array): array {}

/**
* @return array<int|string, int>
* @compile-time-eval
* @refcount 1
*/
function array_count_values(array $array): array {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_column(array $array, int|string|null $column_key, int|string|null $index_key = null): array {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function array_reverse(array $array, bool $preserve_keys = false): array {}

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

/**
* @compile-time-eval
*/
function array_sum(array $array): int|float {}

/**
* @compile-time-eval
*/
function array_product(array $array): int|float {}

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

/**
* @compile-time-eval
*/
function array_chunk(array $array, int $length, bool $preserve_keys = false): array {}

/**
* @compile-time-eval
*/
function array_combine(array $keys, array $values): array {}

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

/**
* @return array<int|string, bool|int|float|string|array|null>|false
* @compile-time-eval
* @refcount 1
*/
function parse_ini_string(string $ini_string, bool $process_sections = false, int $scanner_mode = INI_SCANNER_NORMAL): array|false {}
Expand Down Expand Up @@ -2261,8 +2284,14 @@ function bin2hex(string $string): string {}
*/
function hex2bin(string $string): string|false {}

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

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

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function wordwrap(string $string, int $width = 75, string $break = "\n", bool $cut_long_words = false): string {}

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function strtok(string $string, ?string $token = null): string|false {}

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function stristr(string $haystack, string $needle, bool $before_needle = false): string|false {}

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function strrchr(string $haystack, string $needle): string|false {}

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function chunk_split(string $string, int $length = 76, string $separator = "\r\n"): string {}

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

/** @return string|array<int|string, string> */
/**
* @return string|array<int|string, string>
* @compile-time-eval
*/
function substr_replace(array|string $string, array|string $replace, array|int $offset, array|int|null $length = null): string|array {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function quotemeta(string $string): string {}

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

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

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

/**
* @compile-time-eval
*/
function addcslashes(string $string, string $characters): string {}

/**
* @compile-time-eval
*/
function addslashes(string $string): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function stripcslashes(string $string): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function stripslashes(string $string): string {}

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

/**
* @compile-time-eval
*/
function nl2br(string $string, bool $use_xhtml = true): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function strip_tags(string $string, array|string|null $allowed_tags = null): string {}

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

/**
* @return array<int, int>|string
* @compile-time-eval
* @refcount 1
*/
function count_chars(string $string, int $mode = 0): array|string {}
Expand All @@ -2469,6 +2541,9 @@ function localeconv(): array {}

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

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

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function str_rot13(string $string): string {}

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

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function strpbrk(string $string, string $characters): string|false {}

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

/**
* @compile-time-eval
* @refcount 1
* @deprecated
*/
function utf8_encode(string $string): string {}

/**
* @compile-time-eval
* @refcount 1
* @deprecated
*/
Expand Down Expand Up @@ -2883,10 +2969,16 @@ function http_build_query(array|object $data, string $numeric_prefix = "", ?stri

/* image.c */

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function image_type_to_mime_type(int $image_type): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function image_type_to_extension(int $image_type, bool $include_dot = true): string|false {}

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

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

/**
* @compile-time-eval
*/
function password_algos(): array {}

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

/* quot_print.c */

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function quoted_printable_decode(string $string): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function quoted_printable_encode(string $string): string {}

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

/**
* @return int|string|array<string, int|string>|null|false
* @compile-time-eval
* @refcount 1
*/
function parse_url(string $url, int $component = -1): int|string|array|null|false {}
Expand Down Expand Up @@ -3592,10 +3694,16 @@ function stream_filter_register(string $filter_name, string $class): bool {}

/* uuencode.c */

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function convert_uuencode(string $string): string {}

/** @refcount 1 */
/**
* @compile-time-eval
* @refcount 1
*/
function convert_uudecode(string $string): string|false {}

/* var.c */
Expand Down
Loading