Admin/myprofile Call to a member function Fields() on null

Silverstripe Version: 4.11

Question: When Member has CMS access but not direct access to Security section the myprofile page will not load. It returns a server error.

It appears that parent::getEditForm() is returning null. Does anyone know what the cause of this may be?

# [Emergency] Uncaught Error: Call to a member function Fields() on null

### GET /admin/myprofile

Line **34** in **/vendor/silverstripe/admin/code/CMSProfileController.php**

I can’t reproduce this from a fresh install of Silverstripe CMS 4.11 - I presume you are seeing this in an active project with a bunch of customisations and extra modules. Can you please try reproducing from a fresh install?

It looks like the only case where that form should be null is if there’s a permission failure - it may pay for you to throw a breakpoint in the top of LeftAndMain::getEditForm() and run through a debugger to see what’s going on there.

Thanks for your help!

I was able to see in LeftAndMain::getEditForm() that $record->canView() was returning false. I then located a Member extension that was doing a permission check for CMS_ACCESS_SecurityAdmin.

Got it all sorted now.

1 Like