mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-20 22:05:35 -04:00
updating random_compat library to 2.0.15 (not upgrading identicon, would raise PHP requirements to 5.5)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2015 - 2016 Paragon Initiative Enterprises
|
||||
* Copyright (c) 2015 - 2018 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
|
||||
@@ -51,7 +51,7 @@ if (!is_callable('RandomCompat_strlen')) {
|
||||
);
|
||||
}
|
||||
|
||||
return mb_strlen($binary_string, '8bit');
|
||||
return (int) mb_strlen($binary_string, '8bit');
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -73,7 +73,7 @@ if (!is_callable('RandomCompat_strlen')) {
|
||||
'RandomCompat_strlen() expects a string'
|
||||
);
|
||||
}
|
||||
return strlen($binary_string);
|
||||
return (int) strlen($binary_string);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ if (!is_callable('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 (!is_callable('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 (!is_callable('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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user