PHP Fatal error: Uncaught Error: Call to undefined function 주로 사용하고자 하는 함수가 선언되지 않았을 때 나타나는 오류. function을 사용 할 때 function명을 올바로 썼는지 혹은 function이 선언되어 있는지 확인해야 한다. 예시) // Bad; @include_once('/data/funcstions.php'); $test = call_the_function(); // Good! @include_once('/data/funcstions.php'); if(function_exists('call_the_function')){ $test = call_the_function(); }
PHP Fatal error: Cannot redeclare function() (previously declared in ~) 주로 상단에 include한 파일중에 이미 선언된 function 이름과 같은 function을 또 선언했을때 나타나는 오류. function_exists()로 선언하고자 하는 function 이름이 이미 선언되어 있는지 체크 필요. 예시) // Bad; @include_once '/data/functions.php'; function test_function(){ } // GOOD! @include_once '/data/functions.php'; if(function_exists('test_function') == false){ function test_function(){..
PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in sizeof()함수를 사용할 때 array 혹은 object타입인지 체크를 하지 않아서 생기는 오류. 예시) sizeof($string); // Bad; if(is_array($stirng) || is_object($stirng)){ sizeof($string); // Good! }
session_is_registered(), session_register() 는 deprecated되었다. 대체로 isset($_SESSION['session']), $_SEESION['session'] 으로 사용 가능. 예시) // Bad session_is_registered('seesion'); //Good isset($_SESSION['session']);
[convert mysql to mysqli] mysql_connect mysql_select_db 등 mysql 함수가 deprecated되면서 mysqli 함수로 변경해 주어야 한다. 예시) //BAD $connect = mysql_connect($mysql_host,$mysql_user,$mysql_pw); mysql_select_db($mysql_db, $connect); mysql_query($query); mysql_affected_rows(); mysql_fetch_array($result); mysql_escape_string($string); //GOOD $connect =mysqli_connect($mysql_host,$mysql_user,$mysql_pw); mysqli_select_..
// Bad; $HTTP_GET_VARS['get']; // Good; $_GET['get']; $HTTP_GET_VARS는 $_GET로 대체 가능