Пример #1
0
 public function __construct()
 {
     self::$lookupResultNotFound = new XRef_LookupResult(XRef_LookupResult::NOT_FOUND);
     // fix some weirdness - function signatures returned by reflection
     // (or by "php --rf <function-name>") are inaccurate and
     // different from documentation & from real world
     if (version_compare(phpversion(), "5.3", "<")) {
         // hate php 5.2 - introspection is so inaccurate,
         // so instead of relying on it, let's read prepared
         // descriptions of core functions
         $data_dir = "@data_dir@" == "@" . "data_dir@" ? dirname(__FILE__) . "/../../data" : "@data_dir@/XRef/data";
         $php_52_functions_file = $data_dir . "/php5.2.functions.ser";
         $content = file_get_contents($php_52_functions_file);
         if ($content === false) {
             throw new Exception("Can't read data from file '{$php_52_functions_file}'");
         }
         $functions = unserialize($content);
         if ($functions === false) {
             throw new Exception("Can't unserialize data from '{$php_52_functions_file}'");
         }
         self::$overrideInternalFunctions = array_merge(self::$overrideInternalFunctions, $functions);
         self::$overrideInternalClasses = array('DateTime' => array('__construct' => '__construct($time=null, $object=null)'), 'DateTimeZone' => array('__construct' => '__construct($timezone)'));
     }
     // php 5.3 has some weirdness too
     self::$overrideInternalFunctions = array_merge(self::$overrideInternalFunctions, array('array_multisort' => 'array_multisort(&$array, ...)', 'debug_backtrace' => 'debug_backtrace($options = null, $limit = null)', 'define' => 'define($constant_name, $value, $case_insensitive = false)', 'implode' => 'implode($glue, $pieces = null)', 'json_decode' => 'json_decode($json, $assoc = null, $depth = null, $options = null)', 'php_uname' => 'php_uname($mode = null)', 'spl_autoload_register' => 'spl_autoload_register($autoload_function = null, $throw = true, $prepend = false)', 'stream_set_timeout' => 'stream_set_timeout($stream, $seconds, $microseconds = 0)', 'strtok' => 'strtok($str, $token = null)'));
 }