Skip to content

Commit 51ea7fc

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 51905cd + 8807889 commit 51ea7fc

File tree

6 files changed

+35
-28
lines changed

6 files changed

+35
-28
lines changed

Zend/zend_API.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2701,6 +2701,7 @@ ZEND_API int zend_disable_class(char *class_name, size_t class_name_length) /* {
27012701
{
27022702
zend_class_entry *disabled_class;
27032703
zend_string *key;
2704+
zend_function *fn;
27042705

27052706
key = zend_string_alloc(class_name_length, 0);
27062707
zend_str_tolower_copy(ZSTR_VAL(key), class_name, class_name_length);
@@ -2709,8 +2710,16 @@ ZEND_API int zend_disable_class(char *class_name, size_t class_name_length) /* {
27092710
if (!disabled_class) {
27102711
return FAILURE;
27112712
}
2713+
27122714
INIT_CLASS_ENTRY_INIT_METHODS((*disabled_class), disabled_class_new);
27132715
disabled_class->create_object = display_disabled_class;
2716+
2717+
ZEND_HASH_FOREACH_PTR(&disabled_class->function_table, fn) {
2718+
if ((fn->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
2719+
fn->common.scope == disabled_class) {
2720+
zend_free_internal_arg_info(&fn->internal_function);
2721+
}
2722+
} ZEND_HASH_FOREACH_END();
27142723
zend_hash_clean(&disabled_class->function_table);
27152724
return SUCCESS;
27162725
}

Zend/zend_opcode.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ ZEND_API void destroy_zend_function(zend_function *function)
104104

105105
void zend_free_internal_arg_info(zend_internal_function *function) {
106106
if ((function->fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
107-
!function->scope && function->arg_info) {
107+
function->arg_info) {
108108

109109
uint32_t i;
110110
uint32_t num_args = function->num_args + 1;
@@ -135,7 +135,10 @@ ZEND_API void zend_function_dtor(zval *zv)
135135
ZEND_ASSERT(function->common.function_name);
136136
zend_string_release_ex(function->common.function_name, 1);
137137

138-
zend_free_internal_arg_info(&function->internal_function);
138+
/* For methods this will be called explicitly. */
139+
if (!function->common.scope) {
140+
zend_free_internal_arg_info(&function->internal_function);
141+
}
139142

140143
if (!(function->common.fn_flags & ZEND_ACC_ARENA_ALLOCATED)) {
141144
pefree(function, 1);
@@ -352,8 +355,7 @@ ZEND_API void destroy_zend_class(zval *zv)
352355
ZEND_HASH_FOREACH_PTR(&ce->function_table, fn) {
353356
if ((fn->common.fn_flags & (ZEND_ACC_HAS_RETURN_TYPE|ZEND_ACC_HAS_TYPE_HINTS)) &&
354357
fn->common.scope == ce) {
355-
/* reset function scope to allow arg_info removing */
356-
fn->common.scope = NULL;
358+
zend_free_internal_arg_info(&fn->internal_function);
357359
}
358360
} ZEND_HASH_FOREACH_END();
359361

ext/standard/proc_open.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
7575
char **ep;
7676
#endif
7777
char *p;
78-
size_t cnt, l, sizeenv = 0;
78+
size_t cnt, sizeenv = 0;
7979
HashTable *env_hash;
8080

8181
memset(&env, 0, sizeof(env));
@@ -122,25 +122,20 @@ static php_process_env_t _php_array_to_envp(zval *environment, int is_persistent
122122
p = env.envp = (char *) pecalloc(sizeenv + 4, 1, is_persistent);
123123

124124
ZEND_HASH_FOREACH_STR_KEY_PTR(env_hash, key, str) {
125-
if (key) {
126-
l = ZSTR_LEN(key) + ZSTR_LEN(str) + 2;
127-
memcpy(p, ZSTR_VAL(key), ZSTR_LEN(key));
128-
strncat(p, "=", 1);
129-
strncat(p, ZSTR_VAL(str), ZSTR_LEN(str));
130-
131-
#ifndef PHP_WIN32
132-
*ep = p;
133-
++ep;
134-
#endif
135-
p += l;
136-
} else {
137-
memcpy(p, ZSTR_VAL(str), ZSTR_LEN(str));
138125
#ifndef PHP_WIN32
139-
*ep = p;
140-
++ep;
126+
*ep = p;
127+
++ep;
141128
#endif
142-
p += ZSTR_LEN(str) + 1;
129+
130+
if (key) {
131+
memcpy(p, ZSTR_VAL(key), ZSTR_LEN(key));
132+
p += ZSTR_LEN(key);
133+
*p++ = '=';
143134
}
135+
136+
memcpy(p, ZSTR_VAL(str), ZSTR_LEN(str));
137+
p += ZSTR_LEN(str);
138+
*p++ = '\0';
144139
zend_string_release_ex(str, 0);
145140
} ZEND_HASH_FOREACH_END();
146141

ext/standard/user_filters.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,9 @@ static php_stream_filter *user_filter_factory_create(const char *filtername,
292292
memcpy(wildcard, filtername, len + 1); /* copy \0 */
293293
period = wildcard + (period - filtername);
294294
while (period) {
295-
*period = '\0';
296-
strncat(wildcard, ".*", 2);
295+
ZEND_ASSERT(period[0] == '.');
296+
period[1] = '*';
297+
period[2] = '\0';
297298
if (NULL != (fdat = zend_hash_str_find_ptr(BG(user_filter_map), wildcard, strlen(wildcard)))) {
298299
period = NULL;
299300
} else {

main/streams/filter.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ PHPAPI php_stream_filter *php_stream_filter_create(const char *filtername, zval
239239
memcpy(wildname, filtername, n+1);
240240
period = wildname + (period - filtername);
241241
while (period && !filter) {
242-
*period = '\0';
243-
strncat(wildname, ".*", 2);
242+
ZEND_ASSERT(period[0] == '.');
243+
period[1] = '*';
244+
period[2] = '\0';
244245
if (NULL != (factory = zend_hash_str_find_ptr(filter_hash, wildname, strlen(wildname)))) {
245246
filter = factory->create_filter(filtername, filterparams, persistent);
246247
}

sapi/cli/php_cli.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,18 @@ static void print_extensions(void) /* {{{ */
236236

237237
static inline int sapi_cli_select(php_socket_t fd)
238238
{
239-
fd_set wfd, dfd;
239+
fd_set wfd;
240240
struct timeval tv;
241241
int ret;
242242

243243
FD_ZERO(&wfd);
244-
FD_ZERO(&dfd);
245244

246245
PHP_SAFE_FD_SET(fd, &wfd);
247246

248247
tv.tv_sec = (long)FG(default_socket_timeout);
249248
tv.tv_usec = 0;
250249

251-
ret = php_select(fd+1, &dfd, &wfd, &dfd, &tv);
250+
ret = php_select(fd+1, NULL, &wfd, NULL, &tv);
252251

253252
return ret != -1;
254253
}

0 commit comments

Comments
 (0)