1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  sapi/fpm: remove use of variable-length arrays (#10645)
This commit is contained in:
Niels Dossche
2025-12-14 23:30:54 +01:00
2 changed files with 7 additions and 9 deletions

View File

@@ -39,15 +39,14 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ *
int callers_limit = child->wp->config->request_slowlog_trace_depth;
pid_t pid = child->pid;
struct timeval tv;
static const int buf_size = 1024;
char buf[buf_size];
char buf[1024];
long execute_data;
long path_translated;
long l;
gettimeofday(&tv, 0);
zlog_print_time(&tv, buf, buf_size);
zlog_print_time(&tv, buf, sizeof(buf));
fprintf(slowlog, "\n%s [pool %s] pid %d\n", buf, child->wp->config->name, (int) pid);
@@ -57,7 +56,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ *
path_translated = l;
if (0 > fpm_trace_get_strz(buf, buf_size, path_translated)) {
if (0 > fpm_trace_get_strz(buf, sizeof(buf), path_translated)) {
return -1;
}
@@ -103,7 +102,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ *
ZEND_UNREACHABLE();
}
} else {
if (0 > fpm_trace_get_strz(buf, buf_size, function_name + offsetof(zend_string, val))) {
if (0 > fpm_trace_get_strz(buf, sizeof(buf), function_name + offsetof(zend_string, val))) {
return -1;
}
@@ -149,7 +148,7 @@ static int fpm_php_trace_dump(struct fpm_child_s *child, FILE *slowlog) /* {{{ *
file_name = l;
if (0 > fpm_trace_get_strz(buf, buf_size, file_name + offsetof(zend_string, val))) {
if (0 > fpm_trace_get_strz(buf, sizeof(buf), file_name + offsetof(zend_string, val))) {
return -1;
}

View File

@@ -168,9 +168,8 @@ int fpm_stdio_flush_child(void)
static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg) /* {{{ */
{
static const int max_buf_size = 1024;
int fd = ev->fd;
char buf[max_buf_size];
char buf[1024];
struct fpm_child_s *child;
int is_stdout;
struct fpm_event_s *event;
@@ -216,7 +215,7 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
while (1) {
stdio_read:
in_buf = read(fd, buf, max_buf_size - 1);
in_buf = read(fd, buf, sizeof(buf) - 1);
if (in_buf <= 0) { /* no data */
if (in_buf == 0 || !PHP_IS_TRANSIENT_ERROR(errno)) {
/* pipe is closed or error */