diff options
author | Frédéric Guillot <fred@kanboard.net> | 2017-12-15 13:27:25 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2017-12-15 13:27:25 -0800 |
commit | 8e6476b4028e44687e10bf7fb2617a2d2fff97d2 (patch) | |
tree | f010db02cb0ff016bdc806a0a87e1a4b21946f0a /vendor/paragonie/random_compat/lib/byte_safe_strings.php | |
parent | a93b8e10f5954be0853eec693c13e84c4bd9e6f2 (diff) |
Update composer dependencies
Diffstat (limited to 'vendor/paragonie/random_compat/lib/byte_safe_strings.php')
-rw-r--r-- | vendor/paragonie/random_compat/lib/byte_safe_strings.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php index dec5d306..3de86b22 100644 --- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,7 +26,7 @@ * SOFTWARE. */ -if (!function_exists('RandomCompat_strlen')) { +if (!is_callable('RandomCompat_strlen')) { if ( defined('MB_OVERLOAD_STRING') && ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING @@ -51,7 +51,7 @@ if (!function_exists('RandomCompat_strlen')) { ); } - return mb_strlen($binary_string, '8bit'); + return (int) mb_strlen($binary_string, '8bit'); } } else { @@ -73,12 +73,12 @@ if (!function_exists('RandomCompat_strlen')) { 'RandomCompat_strlen() expects a string' ); } - return strlen($binary_string); + return (int) strlen($binary_string); } } } -if (!function_exists('RandomCompat_substr')) { +if (!is_callable('RandomCompat_substr')) { if ( defined('MB_OVERLOAD_STRING') @@ -118,7 +118,7 @@ if (!function_exists('RandomCompat_substr')) { * mb_substr($str, 0, NULL, '8bit') returns an empty string on * PHP 5.3, so we have to find the length ourselves. */ - $length = RandomCompat_strlen($length) - $start; + $length = RandomCompat_strlen($binary_string) - $start; } elseif (!is_int($length)) { throw new TypeError( 'RandomCompat_substr(): Third argument should be an integer, or omitted' @@ -130,10 +130,10 @@ if (!function_exists('RandomCompat_substr')) { return ''; } if ($start > RandomCompat_strlen($binary_string)) { - return false; + return ''; } - return mb_substr($binary_string, $start, $length, '8bit'); + return (string) mb_substr($binary_string, $start, $length, '8bit'); } } else { @@ -172,10 +172,10 @@ if (!function_exists('RandomCompat_substr')) { ); } - return substr($binary_string, $start, $length); + return (string) substr($binary_string, $start, $length); } - return substr($binary_string, $start); + return (string) substr($binary_string, $start); } } } |