1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pChart を PHP7 対応させる方法

Posted at

#概略
pChart を、PHP7 で動かすとエラーが出て正常に動いてくれません。これの暫定的な対応策です。とりあえず動いてくれればいいや、という状況向け。

#詳細

こんな感じのエラーが出ます。

Fatal error: Uncaught Error: Cannot use string offset as an array "pchart"

エラーの原因としては、変数を後から配列扱いすると PHP7 でエラーが出るようになったのが原因なので、pChart.class と pData.class を何箇所か修正すると正常に動くようになります。

$this->Data = "";
$this->DataDescription = "";

↓ 以下のように初期化宣言を直す。

$this->Data = array();
$this->DataDescription = array();

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?