diff --git a/includes/functions.php b/includes/functions.php index 5730b7b44b..a038bab960 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1624,6 +1624,12 @@ function q_bridge_bits2indices($hex_data) * ie. '9a00' -> '100110100000' -> array(1, 4, 5, 7) */ $hex_data = str_replace(' ', '', $hex_data); + + // we need an even number of digits for hex2bin + if (strlen($hex_data) % 2 === 1) { + $hex_data = '0' . $hex_data; + } + $value = hex2bin($hex_data); $length = strlen($value); $indices = [];