for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Trait MemzeroDestructorTrait
*
* @filesource MemzeroDestructorTrait.php
* @created 25.01.2018
* @package chillerlan\Traits\Crypto
* @author Smiley <[email protected]>
* @copyright 2018 Smiley
* @license MIT
*/
namespace chillerlan\Traits\Crypto;
trait MemzeroDestructorTrait{
* @return void
public function __destruct(){
foreach(array_keys(get_object_vars($this)) as $key){
if(is_scalar($this->{$key})){
$this->{$key} = (string)$this->{$key};
sodium_memzero($this->{$key});
}
unset($this->{$key});