All one have to do in Plesk to fix this problem is to add to the open_basedir “:/dev/urandom“. So it looks like this {WEBSPACEROOT}{/}{:}{TMP}{/}:/dev/urandom
// AppBundle\EventListener\UserListener.php
namespace AppBundle\EventListener;
use Doctrine\ORM\Event\LifecycleEventArgs;
use AppBundle\Entity\User;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
class UserListener
{
protected $container;
public function __construct(UserPasswordEncoderInterface $encoder)
{
$this->encoder = $encoder;
}
public function prePersist(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
$encodedPassword = $this->encoder->encodePassword($entity, $entity->getPassword());
$entity->setPassword($encodedPassword);
}
}