Merge "Revert "Adding sanity check to Title::isRedirect().""
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 57ab64c..4cfd946 100644 (file)
@@ -1831,7 +1831,7 @@ function wfDebugBacktrace( $limit = 0 ) {
        }
 
        if ( $limit && version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
-               return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit ), 1 );
+               return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit + 1 ), 1 );
        } else {
                return array_slice( debug_backtrace(), 1 );
        }
@@ -1890,12 +1890,15 @@ function wfBacktrace() {
 
 /**
  * Get the name of the function which called this function
+ * wfGetCaller( 1 ) is the function with the wfGetCaller() call (ie. __FUNCTION__)
+ * wfGetCaller( 2 ) [default] is the caller of the function running wfGetCaller()
+ * wfGetCaller( 3 ) is the parent of that.
  *
  * @param $level Int
  * @return Bool|string
  */
 function wfGetCaller( $level = 2 ) {
-       $backtrace = wfDebugBacktrace( $level );
+       $backtrace = wfDebugBacktrace( $level + 1 );
        if ( isset( $backtrace[$level] ) ) {
                return wfFormatStackFrame( $backtrace[$level] );
        } else {