以下の内容はhttps://iww.hateblo.jp/entry/20231001/Deprecatedより取得しました。


PHP8.1で "Deprecated: ucfirst(): Passing null to parameter #1 ($string) of type string is deprecated in"

PHP8.1で既存のプログラムを動かすと、Deprecated(非推奨)のエラーがやたら出る。

<?php
$a = ucfirst(null);
var_dump($a);
Deprecated: ucfirst(): Passing null to parameter #1 ($string) of type string is deprecated in /home/user/scripts/code.php on line 2
string(0) ""

今までは nullable だったのに、なんか急にダメ扱いにしたのが原因。
www.php.net

また、PHP8.0から error_reporting が E_ALL になって、なんでもかんでもエラーが出力されるようになった。
www.php.net

そのため、PHP5.x 時代の化石を動かすとエラーがドンドコ出る。

暫定的には エラー出力を抑制するのが一番楽

; /etc/php.d/99-hoge.ini

[PHP]
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED



以上の内容はhttps://iww.hateblo.jp/entry/20231001/Deprecatedより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14