From b50ef2dc64f062aefecb7dd3545fc63f86affc77 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 19 Jun 2014 16:14:15 +0200 Subject: [PATCH] Replace phpseclib_resolve_include_path with stream_resolve_include_path. --- phpseclib/Crypt/Random.php | 50 +++++--------------------------------- phpseclib/Net/SSH2.php | 10 ++++---- 2 files changed, 11 insertions(+), 49 deletions(-) diff --git a/phpseclib/Crypt/Random.php b/phpseclib/Crypt/Random.php index 55c6763e..b7d8dac7 100644 --- a/phpseclib/Crypt/Random.php +++ b/phpseclib/Crypt/Random.php @@ -194,37 +194,37 @@ if (!function_exists('crypt_random_string')) { // // http://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator#Designs_based_on_cryptographic_primitives switch (true) { - case phpseclib_resolve_include_path('Crypt/AES.php'): + case stream_resolve_include_path('Crypt/AES.php'): if (!class_exists('Crypt_AES')) { include_once 'AES.php'; } $crypto = new Crypt_AES(CRYPT_AES_MODE_CTR); break; - case phpseclib_resolve_include_path('Crypt/Twofish.php'): + case stream_resolve_include_path('Crypt/Twofish.php'): if (!class_exists('Crypt_Twofish')) { include_once 'Twofish.php'; } $crypto = new Crypt_Twofish(CRYPT_TWOFISH_MODE_CTR); break; - case phpseclib_resolve_include_path('Crypt/Blowfish.php'): + case stream_resolve_include_path('Crypt/Blowfish.php'): if (!class_exists('Crypt_Blowfish')) { include_once 'Blowfish.php'; } $crypto = new Crypt_Blowfish(CRYPT_BLOWFISH_MODE_CTR); break; - case phpseclib_resolve_include_path('Crypt/TripleDES.php'): + case stream_resolve_include_path('Crypt/TripleDES.php'): if (!class_exists('Crypt_TripleDES')) { include_once 'TripleDES.php'; } $crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CTR); break; - case phpseclib_resolve_include_path('Crypt/DES.php'): + case stream_resolve_include_path('Crypt/DES.php'): if (!class_exists('Crypt_DES')) { include_once 'DES.php'; } $crypto = new Crypt_DES(CRYPT_DES_MODE_CTR); break; - case phpseclib_resolve_include_path('Crypt/RC4.php'): + case stream_resolve_include_path('Crypt/RC4.php'): if (!class_exists('Crypt_RC4')) { include_once 'RC4.php'; } @@ -260,41 +260,3 @@ if (!function_exists('crypt_random_string')) { return substr($result, 0, $length); } } - -if (!function_exists('phpseclib_resolve_include_path')) { - /** - * Resolve filename against the include path. - * - * Wrapper around stream_resolve_include_path() (which was introduced in - * PHP 5.3.2) with fallback implementation for earlier PHP versions. - * - * @param string $filename - * @return mixed Filename (string) on success, false otherwise. - * @access public - */ - function phpseclib_resolve_include_path($filename) - { - if (function_exists('stream_resolve_include_path')) { - return stream_resolve_include_path($filename); - } - - // handle non-relative paths - if (file_exists($filename)) { - return realpath($filename); - } - - $paths = PATH_SEPARATOR == ':' ? - preg_split('#(?