From 9bd37bae4d8e15be228e5be5b1b554ddbc37ff0e Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Sun, 22 Jul 2012 13:33:31 +0200 Subject: [PATCH] Removed now obsolete compat-code Change-Id: I64dc4beb4f8a084bfc5b7c60cbdaa6b65838b79b --- includes/db/ORMTable.php | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/includes/db/ORMTable.php b/includes/db/ORMTable.php index 130fdf9ba6..1c9497acbd 100644 --- a/includes/db/ORMTable.php +++ b/includes/db/ORMTable.php @@ -559,7 +559,7 @@ abstract class ORMTable implements IORMTable { * @return IORMTable */ public static function singleton() { - $class = function_exists( 'get_called_class' ) ? get_called_class() : self::get_called_class(); + $class = get_called_class(); if ( !array_key_exists( $class, self::$instanceCache ) ) { self::$instanceCache[$class] = new $class; @@ -568,36 +568,6 @@ abstract class ORMTable implements IORMTable { return self::$instanceCache[$class]; } - /** - * Compatibility fallback function so the singleton method works on PHP < 5.3. - * Code borrowed from http://www.php.net/manual/en/function.get-called-class.php#107445 - * - * @since 1.20 - * - * @return string - */ - protected static function get_called_class() { - $bt = debug_backtrace(); - $l = count($bt) - 1; - $matches = array(); - while(empty($matches) && $l > -1){ - $lines = file($bt[$l]['file']); - $callerLine = $lines[$bt[$l]['line']-1]; - preg_match('/([a-zA-Z0-9\_]+)::'.$bt[$l--]['function'].'/', - $callerLine, - $matches); - } - if (!isset($matches[1])) $matches[1]=NULL; //for notices - if ($matches[1] == 'self') { - $line = $bt[$l]['line']-1; - while ($line > 0 && strpos($lines[$line], 'class') === false) { - $line--; - } - preg_match('/class[\s]+(.+?)[\s]+/si', $lines[$line], $matches); - } - return $matches[1]; - } - /** * Get an array with fields from a database result, * that can be fed directly to the constructor or -- 2.20.1