SessionInterfaceHandler is throwing a deprecation notice as a warning instead of a deprecation

未關閉 適合新手
#26,001 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
74/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
c, php
領域
backend

研究方向

issue 指向 ext/session/session.c 中的 session_handler_interface_gets_implemented()。閱讀兩處缺少方法的檢查,並尋找附近類似的 deprecation 層級診斷,以遵循專案慣例。變更這些通知的警告層級,接著執行相關的 session 測試,並確認缺少 create_sid() 和 validateId() 時會產生 deprecation 通知。

由索引模型根據 Issue 內容生成。

描述

Bug Status: Needs Triage
Description

https://github.com/php/php-src/blob/0d7ee35d4cd826b43fcc536d8ef666726bef9c79/ext/session/session.c#L3063

static void session_handler_interface_gets_implemented(zend_class_entry *self, zend_class_entry *class) {
	if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("create_sid"))
		&& !session_interfaces_include(class, php_session_id_iface_entry)) {
		zend_error(E_WARNING,
			"Class %s implementing SessionHandlerInterface is missing the create_sid() method which will be required in PHP 9.0",
			ZSTR_VAL(class->name));
	}
	if (!zend_hash_str_exists(&class->function_table, ZEND_STRL("validateid"))
		&& !session_interfaces_include(class, php_session_update_timestamp_iface_entry)) {
		zend_error(E_WARNING,
			"Class %s implementing SessionHandlerInterface is missing the validateId() method which will be required in PHP 9.0",
			ZSTR_VAL(class->name));
	}
}

Found this after a PHP 8.5 -> 8.6 upgrade with 3rd party software - tried to filter out deprecation notices but this is coming up as an E_WARNING instead - and it should not be

Simply changing the E_WARNING to a deprecation level should fix the issue - it's annoying!

PHP Version
PHP 8.6.0 (cli) (built: Nov 20 2026 15:07:19) (NTS)
Copyright © The PHP Group and Contributors
Built by Ubuntu
Zend Engine v4.6.0, Copyright © Zend by Perforce
    with Zend OPcache v8.6.0, Copyright ©, by Zend by Perforce
Operating System

No response

主要語言
C
星號
41.9k
分支
8.5k
平均合併
2 天 16 小時
30 天內合併 PR
116

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。