php-src icon indicating copy to clipboard operation
php-src copied to clipboard

sodium_memzero() sets a typed property to null without a TypeError

Open lacatoire opened this issue 2 weeks ago • 0 comments

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)

lacatoire avatar Nov 16 '26 13:11 lacatoire