PHP8.x 에서 "Warning: Undefined array key ..." 를 만나면
Warning: Undefined array key "bo_mobile_subject" in .../lib/new_latest.lib.php on line 139
139: $list[$i]['bo_subject'] = ((G5_IS_MOBILE && $row['bo_mobile_subject']) ? $row['bo_mobile_subject'] : $row['bo_subject']);
=> 정의되지 않은 array key 변수 앞에 @ 를 붙이면 Warning 을 막을 수 있습니다.
$list[$i]['bo_subject'] = ((G5_IS_MOBILE && @$row['bo_mobile_subject']) ? @$row['bo_mobile_subject'] : @$row['bo_subject']);
참고 : https://www.php.net/manual/en/language.operators.errorcontrol.php
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 17개
더군다나 8.0부터는 해당기능이 Deprecate 상태이기때문에 나중버전에서는 삭제될수도 있습니다.
Warning
Prior to PHP 8.0.0, the value of the severity passed to the custom error handler was always 0 if the diagnostic was suppressed. This is no longer the case as of PHP 8.0.0.
순정 G5 에서 없던 Warning 이 갑자기 생겨서 해결책으로 찾은건데 다른 좋은 방법이 있으면 알려주세요~
신고가 접수되어 자동으로 블라인드 된 댓글입니다. 원문을 보시려면 를 클릭하세요.
코드가 보이지 않는데 다시 올려주시면 다른분께 도움이 될듯합니다
코드뒤에 ??'' 를 붙히면 됩니다.
$comp_uids = explode(',', $result['comp_uids'] ?? '');
하.. 이것 때문에 삽질하고 있었는데 감사합니다..