WeakMap::offsetExists return false if value is null
オープン
@Girgias がすでに取り組んでいます。
2024年3月8日 から。
Bug
Category: Engine
Status: Needs Triage
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
$wm = new \WeakMap;
$os = new \SplObjectStorage;
$obj1 = new \stdClass;
$obj2 = new \stdClass;
$wm[$obj1] = null;
$wm[$obj2] = true;
$os[$obj1] = null;
$os[$obj2] = true;
var_dump($wm->offsetExists($obj1));
var_dump($wm->offsetExists($obj2));
var_dump($os->offsetExists($obj1));
var_dump($os->offsetExists($obj2));
foreach ($wm as $key => $value) {
if ($key === $obj1) {
echo 'key $obj1 is always here';
}
}
Resulted in this output:
bool(false)
bool(true)
bool(true)
bool(true)
key $obj1 is always here
But I expected this output instead:
bool(true)
bool(true)
bool(true)
bool(true)
key $obj1 is always here
PHP Version
PHP 8.1.5
Operating System
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。