Skip to content

Commit bbfa1b6

Browse files
committed
Improve fix for bug #73807
At least on some architectures memmove() on FreeBSD does not short-curcuit if src==dst. Check for it explicitly to avoid quadratic copying.
1 parent eac8166 commit bbfa1b6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/php_variables.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static inline int add_post_vars(zval *arr, post_var_data_t *vars, zend_bool eof)
311311
}
312312
}
313313

314-
if (!eof) {
314+
if (!eof && ZSTR_VAL(vars->str.s) != vars->ptr) {
315315
memmove(ZSTR_VAL(vars->str.s), vars->ptr, ZSTR_LEN(vars->str.s) = vars->end - vars->ptr);
316316
}
317317
return SUCCESS;

0 commit comments

Comments
 (0)