Math/PrimeField: fix for when garbage collection has wiped data

This commit is contained in:
terrafrost 2023-07-26 21:34:39 -05:00
parent 69325956ce
commit 25a06f0071

View File

@ -312,8 +312,11 @@ class Integer extends Base
*/
public function toBytes()
{
$length = static::$modulo[$this->instanceID]->getLengthInBytes();
return str_pad($this->value->toBytes(), $length, "\0", STR_PAD_LEFT);
if (isset(static::$modulo[$this->instanceID])) {
$length = static::$modulo[$this->instanceID]->getLengthInBytes();
return str_pad($this->value->toBytes(), $length, "\0", STR_PAD_LEFT);
}
return $this->value->toBytes();
}
/**