updating random_compat library to 2.0.15 (not upgrading identicon, would raise PHP requirements to 5.5)

This commit is contained in:
El RIDO
2018-07-01 15:32:22 +02:00
parent 3745f9d96b
commit fd6c18e573
15 changed files with 461 additions and 380 deletions
+8 -8
View File
@@ -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);
}
}
}