HashTable use-after-destroy during lazy proxy __get() with dynamic properties
オープン
まだ誰も着手していません。
Bug
Category: Engine
Status: Verified
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
#[AllowDynamicProperties]
class RealInstance {
public $_;
public function __get($name) {
global $obj;
$obj->foo ??= $obj->$$a[] =&$$a;
$a[] =$$a;
$x[!0] =$$a;
return $this->name;
}
}
class Proxy extends RealInstance {
public function r_get($name) {
return $this->$name;
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
return new RealInstance;
});
$real = $rc->initializeLazyObject($obj);
var_dump($real->prop);
Resulted in this output:
/path/to/php-src/Zend/zend_hash.c(2699) : ht=0x7f6a9f802900 is already destroyed
php: /path/to/php-src/Zend/zend_hash.c:73: void _zend_is_inconsistent(const HashTable *, const char *, int): Assertion `0' failed.
Aborted
Notes
This bug triggers the same hash table use-after-destroy assertion as #20286 but via a different execution path.
Commit:
56795d2810e
Build configuration:
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" LDFLAGS="-fsanitize=address" ./buildconf --force && ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic --enable-mbstring --with-zlib
PHP Version
PHP 8.6.0-dev (cli) (built: Nov 29 2025 14:32:34) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
Operating System
Ubuntu 22.04
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された reproducer を、文書化されている debug および AddressSanitizer ビルドで実行し、その後 zend_hash.c の assertion と、__get()、newLazyProxy()、initializeLazyObject() を通る lazy proxy のパスを調査します。完了条件は、reproducer が HashTable use-after-destroy assertion に到達しなくなり、この実行パスをカバーする回帰テストが追加されていることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100