openssl_error_string() returns errors left by a previous request

オープン
#25,521 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
php
領域
backend, security

調査の方向性

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

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
C
スター
41.8k
フォーク
8.6k
平均マージ
2日 15時間
マージ済み PR(30日)
125

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

php/php-src のほかの issue

php/php-src の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。