Call to a member function encrypt() on null