본문 바로가기

Story/php

PHP 5.3 이상에서 Deprecated 에러 발생시 처리

반응형

PHP Deprecated:  Function [함수명] is deprecated

해당 에러 문구는 PHP 6.0부터는 해당 함수들이 제거될 예정이니 개발시 더 이상 사용하지 말 것을 권고하는 메시지입니다.
경고 메시지이므로 사용상에 문제는 없으며, php.ini 파일을 수정하여  해당 문구가 발생하지 않도록 설정할 수 있습니다.

# vi php.ini

519 ; Production Value: E_ALL & ~E_DEPRECATED
520 ; http://php.net/error-reporting
521 error_reporting = E_ALL & ~E_NOTICE


521번째 줄의
error_reporting = E_ALL & ~E_NOTICE 항목을
error_reporting = "E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED"

주의1) 큰 따옴표(")도 반드시 넣어야 합니다.

로 변경한 뒤 아파치 재시작

또는 소스상에

error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_USER_DEPRECATED);

이나
error_reporting(E_ALL & ~( E_NOTICE | E_DEPRECATED | E_USER_DEPRECATED ));

..

@error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);

-> E_NOTICE와 E_DEPRECATED는 보지 않겠다는 의미

 

출처 http://faq.hostway.co.kr/Linux_WEB/1274

 


Deprecated features in PHP 5.3.x

PHP 5.3.0 introduces two new error levels: E_DEPRECATED and E_USER_DEPRECATED. The E_DEPRECATED error level is used to indicate that a function or feature has been deprecated. The E_USER_DEPRECATED level is intended for indicating deprecated features in user code, similarly to the E_USER_ERROR and E_USER_WARNING levels.

The following is a list of deprecated INI directives. Use of any of these INI directives will cause an E_DEPRECATED error to be thrown at startup.

Deprecated functions:

Deprecated features:

  • Assigning the return value of new by reference is now deprecated.
  • Call-time pass-by-reference is now deprecated.

http://kr1.php.net/manual/en/migration53.deprecated.php

반응형