Issue #3084955 by kiamlaluno, mcdruid, Taran2L: Invalid characters passed for attempted conversion, these have been ignored in _color_unpack()

merge-requests/26/head
mcdruid 2020-03-14 16:18:02 +00:00
parent b20c7a939a
commit 398945d6db
1 changed files with 3 additions and 2 deletions

View File

@ -734,8 +734,9 @@ function _color_blend($img, $hex1, $hex2, $alpha) {
* Converts a hex color into an RGB triplet.
*/
function _color_unpack($hex, $normalize = FALSE) {
if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
$hex = substr($hex, 1);
if (strlen($hex) == 3) {
$hex = $hex[0] . $hex[0] . $hex[1] . $hex[1] . $hex[2] . $hex[2];
}
$c = hexdec($hex);
for ($i = 16; $i >= 0; $i -= 8) {