openssl_error_string() returns errors left by a previous request

Offen
#25,521 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
56/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
php
Bereich
backend, security

Rechercherichtung

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).

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
C
Sterne
41.8k
Forks
8.6k
Ø Merge
2 T. 15 Std.
Gemergte PRs (30 T.)
125

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus php/php-src

Alle Issues in php/php-src

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.