Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Lazy object reset with object destructor can lead to use-after-free

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

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

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

評価

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

調査の方向性

Start by reading Zend/zend_lazy_objects.c around zend_object_make_lazy at line 338, then compare the resetAsLazyGhost() and resetAsLazyProxy() paths with the related re-entrant destruction issue #22399. Reproduce with the supplied PHP snippet under AddressSanitizer; done means both reset methods avoid the heap-use-after-free.

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

説明

Bug Status: Needs Triage
Description

Originally reported by @cnwangjihe.

The re-entrant property destruction issue reported in #22399 also affects ReflectionClass::resetAsLazyGhost() and ReflectionClass::resetAsLazyProxy().

The following code:

<?php

class Target {
    public ?Trigger $trigger = null;
}

class Trigger {
    public function __construct(private object $target) {}

    public function __destruct() {
        unset($this->target->trigger);
    }
}

$reflection = new ReflectionClass(Target::class);
$target = new Target();
$target->trigger = new Trigger($target);

$reflection->resetAsLazyGhost($target, static function (): void {});

Resulted in this output:

ERROR: AddressSanitizer: heap-use-after-free
zend_object_make_lazy Zend/zend_lazy_objects.c:338

But I expected this output instead:

PHP Version
PHP 8.4+
Operating System

No response

主要言語
C
スター
40.7k
フォーク
8.3k
平均マージ
2日 16時間
マージ済み PR(30日)
151

環境構築

はじめの一歩

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

php/php-src のほかの issue

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

似ている issue

C の issue をもっと見る

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

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