Skip to content

Commit 96a3088

Browse files
committed
Merge branch 'PHP-8.3'
2 parents 9e66bc9 + 5e8c992 commit 96a3088

File tree

3 files changed

+20
-19
lines changed

3 files changed

+20
-19
lines changed

ext/opcache/ZendAccelerator.c

+5-18
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,6 @@ static time_t zend_accel_get_time(void)
187187
# define zend_accel_get_time() time(NULL)
188188
#endif
189189

190-
static inline bool is_stream_path(const char *filename)
191-
{
192-
const char *p;
193-
194-
for (p = filename;
195-
(*p >= 'a' && *p <= 'z') ||
196-
(*p >= 'A' && *p <= 'Z') ||
197-
(*p >= '0' && *p <= '9') ||
198-
*p == '+' || *p == '-' || *p == '.';
199-
p++);
200-
return ((p != filename) && (p[0] == ':') && (p[1] == '/') && (p[2] == '/'));
201-
}
202-
203190
static inline bool is_cacheable_stream_path(const char *filename)
204191
{
205192
return memcmp(filename, "file://", sizeof("file://") - 1) == 0 ||
@@ -1060,7 +1047,7 @@ accel_time_t zend_get_file_handle_timestamp(zend_file_handle *file_handle, size_
10601047
if (file_handle->opened_path) {
10611048
char *file_path = ZSTR_VAL(file_handle->opened_path);
10621049

1063-
if (is_stream_path(file_path)) {
1050+
if (php_is_stream_path(file_path)) {
10641051
if (zend_get_stream_timestamp(file_path, &statbuf) == SUCCESS) {
10651052
break;
10661053
}
@@ -1208,7 +1195,7 @@ zend_string *accel_make_persistent_key(zend_string *str)
12081195
/* CWD and include_path don't matter for absolute file names and streams */
12091196
if (IS_ABSOLUTE_PATH(path, path_length)) {
12101197
/* pass */
1211-
} else if (UNEXPECTED(is_stream_path(path))) {
1198+
} else if (UNEXPECTED(php_is_stream_path(path))) {
12121199
if (!is_cacheable_stream_path(path)) {
12131200
return NULL;
12141201
}
@@ -1891,7 +1878,7 @@ zend_op_array *file_cache_compile_file(zend_file_handle *file_handle, int type)
18911878
zend_op_array *op_array = NULL;
18921879
bool from_memory; /* if the script we've got is stored in SHM */
18931880

1894-
if (is_stream_path(ZSTR_VAL(file_handle->filename)) &&
1881+
if (php_is_stream_path(ZSTR_VAL(file_handle->filename)) &&
18951882
!is_cacheable_stream_path(ZSTR_VAL(file_handle->filename))) {
18961883
return accelerator_orig_compile_file(file_handle, type);
18971884
}
@@ -2036,7 +2023,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
20362023
return accelerator_orig_compile_file(file_handle, type);
20372024
}
20382025
persistent_script = zend_accel_hash_find(&ZCSG(hash), key);
2039-
} else if (UNEXPECTED(is_stream_path(ZSTR_VAL(file_handle->filename)) && !is_cacheable_stream_path(ZSTR_VAL(file_handle->filename)))) {
2026+
} else if (UNEXPECTED(php_is_stream_path(ZSTR_VAL(file_handle->filename)) && !is_cacheable_stream_path(ZSTR_VAL(file_handle->filename)))) {
20402027
ZCG(cache_opline) = NULL;
20412028
ZCG(cache_persistent_script) = NULL;
20422029
return accelerator_orig_compile_file(file_handle, type);
@@ -4050,7 +4037,7 @@ static void preload_link(void)
40504037

40514038
static zend_string *preload_resolve_path(zend_string *filename)
40524039
{
4053-
if (is_stream_path(ZSTR_VAL(filename))) {
4040+
if (php_is_stream_path(ZSTR_VAL(filename))) {
40544041
return NULL;
40554042
}
40564043
return zend_resolve_path(filename);

ext/standard/filestat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value)
729729
char realpath[MAXPATHLEN];
730730
const char *file_path_to_check;
731731
/* if the wrapper is not found, we need to expand path to match open behavior */
732-
if (EXPECTED(strstr(local, "://") == NULL || expand_filepath(local, realpath) == NULL)) {
732+
if (EXPECTED(!php_is_stream_path(local) || expand_filepath(local, realpath) == NULL)) {
733733
file_path_to_check = local;
734734
} else {
735735
file_path_to_check = realpath;

main/php_streams.h

+14
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,20 @@ PHPAPI HashTable *_php_get_stream_filters_hash(void);
619619
#define php_get_stream_filters_hash() _php_get_stream_filters_hash()
620620
PHPAPI HashTable *php_get_stream_filters_hash_global(void);
621621
extern const php_stream_wrapper_ops *php_stream_user_wrapper_ops;
622+
623+
static inline bool php_is_stream_path(const char *filename)
624+
{
625+
const char *p;
626+
627+
for (p = filename;
628+
(*p >= 'a' && *p <= 'z') ||
629+
(*p >= 'A' && *p <= 'Z') ||
630+
(*p >= '0' && *p <= '9') ||
631+
*p == '+' || *p == '-' || *p == '.';
632+
p++);
633+
return ((p != filename) && (p[0] == ':') && (p[1] == '/') && (p[2] == '/'));
634+
}
635+
622636
END_EXTERN_C()
623637
#endif
624638

0 commit comments

Comments
 (0)