$fp = false;
}
}
+
if (!empty($fp)) {
/**
* stream_set_read_buffer() does not exist in HHVM
}
}
}
+
try {
$bytes = RandomCompat_intval($bytes);
} catch (TypeError $ex) {
'random_bytes(): $bytes must be an integer'
);
}
+
if ($bytes < 1) {
throw new Error(
'Length must be greater than 0'
);
}
+
/**
* This if() block only runs if we managed to open a file handle
*
if (!empty($fp)) {
$remaining = $bytes;
$buf = '';
+
/**
* We use fread() in a loop to protect against partial reads
*/
}
}
}
+
/**
* If we reach here, PHP has failed us.
*/