Call to a member function offsetExists() on bool