php / php/php-src

Creation of dynamic property is deprecated !

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

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

Bug Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

Description

The following code ( This should never happen when I'm using magic methods, but unfortunately it does happen sometimes ):

<?php
final class Content {
	protected array $data = array('sequence'=>1);

	public function &__get(string $property) : mixed {
		if(isset($this->data[$property]) === false):
			$this->data[$property] = null;
		endif;
		return $this->data[$property];
	}
	public function __set(string $name,mixed $value) : void {
		$this->data[$name] = $value;
	}
}

$content = new Content();
$result = $content->sequence * 2 + 1;
$content->sequence += 1;
print $result;

Result:

3

But sometimes when the number of such requests increases, I receive the following warning :

Creation of dynamic property Content::$sequence is deprecated 18
PHP Version

PHP 8.2.11

Operating System

Linux

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず、issue に記載された PHP 8.2.11 の再現を Linux 上で実行し、マジックメソッドへのアクセスと報告されている動的プロパティの警告を比較します。警告がどこで発生するのかを特定するため、__get、__set、および複合代入のランタイム処理を追跡します。完了条件には、確認済みの説明と、回帰テストまたは明確に定義された動作変更を含める必要があります。

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

評価

技術スタック
php
領域
backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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