X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FError.php;h=163a1b44d3be97becc043098d084b55665635074;hb=a65f52b63ddf8b85bbf7abb98155fb2a9bf2a693;hp=a32df209640f523f957c6236db59c63459caf9db;hpb=f4b356553186f33e57e1581e76e866bfa4ba30ed;p=civicrm-core.git diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index a32df20964..163a1b44d3 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -1,9 +1,9 @@ htmlspecialchars($message), + 'message' => $message, 'code' => $code, ); @@ -1030,6 +1030,19 @@ class CRM_Core_Error extends PEAR_ErrorStack { return FALSE; } + /** + * Output a deprecated function warning to log file. Deprecated class:function is automatically generated from calling function. + * + * @param $newMethod + * description of new method (eg. "buildOptions() method in the appropriate BAO object"). + */ + public static function deprecatedFunctionWarning($newMethod) { + $dbt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 2); + $callerFunction = isset($dbt[1]['function']) ? $dbt[1]['function'] : NULL; + $callerClass = isset($dbt[1]['class']) ? $dbt[1]['class'] : NULL; + Civi::log()->warning("Deprecated function $callerClass::$callerFunction, use $newMethod.", array('civi.tag' => 'deprecated')); + } + } $e = new PEAR_ErrorStack('CRM');