openssl_error_string() returns errors left by a previous request

Abierto
#25,521 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
1-2 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
php
Área
backend, security

Línea de trabajo

Start by tracing how PHP stores OpenSSL errors in OPENSSL_G(errors) and how request shutdown cleanup is handled in the PHP source. Reproduce the reported behavior with php-fpm configured for one static worker, then check whether clearing the queue during RSHUTDOWN makes the second request return bool(false).

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug Status: Needs Triage
Description

OpenSSL errors from one request show up in the next request of the same worker. PHP keeps them in OPENSSL_G(errors), which is only freed in GSHUTDOWN.

php-fpm with pm = static and pm.max_children = 1, so both requests hit one worker:

<?php
if ($_SERVER['QUERY_STRING'] === 'fail') {
    @openssl_x509_read('not a certificate');
} else {
    var_dump(openssl_error_string());
}

Request ?fail, then ?check.

Resulted in this output:

string(42) "error:0480006C:PEM routines::no start line"

But I expected this output instead:

bool(false)

I think the queue should be cleared in RSHUTDOWN. I can send a PR.

PHP Version
PHP 8.7.0-dev (master). The same code is in 8.3, 8.4 and 8.5.
Operating System

Ubuntu 26.04, OpenSSL 3.5.5

Lenguaje dominante
C
Estrellas
41.8k
Forks
8.6k
Merge medio
2 d 15 h
PR fusionados (30 d)
125

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de php/php-src

Todos los issues de php/php-src

Issues similares

Más issues de C

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.