From b50ef2dc64f062aefecb7dd3545fc63f86affc77 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 19 Jun 2014 16:14:15 +0200 Subject: [PATCH 1/2] 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('#(? Date: Thu, 19 Jun 2014 16:16:20 +0200 Subject: [PATCH 2/2] Depend on PHP 5.3.2 accordingly. --- composer.json | 2 +- composer.lock | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 972dd184..bf67f731 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ } ], "require": { - "php": ">=5.3.0" + "php": ">=5.3.2" }, "require-dev": { "phing/phing": "2.7.*", diff --git a/composer.lock b/composer.lock index 736cebfc..bd0c6b24 100644 --- a/composer.lock +++ b/composer.lock @@ -1,9 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" ], - "hash": "1c5f986d03274ed0b7d509768d1bf277", + "hash": "c798aae793e5a1293ee41fbf9c9bdbfa", "packages": [ ], @@ -769,7 +770,7 @@ ], "platform": { - "php": ">=5.3.0" + "php": ">=5.3.2" }, "platform-dev": [