php-src
php-src copied to clipboard
sodium_memzero() sets a typed property to null without a TypeError
sodium_memzero() assigns null to its argument without checking the type of a property the reference comes from, so a non-nullable property ends up holding null.
class A { public string $s = 'secret'; }
$a = new A;
sodium_memzero($a->s);
var_dump($a->s); // NULL, no TypeError (settype($a->s, 'null') throws)