Can't locate the cause of this issue

Silverstripe Version: 3.7.3

Question:

Hello, we have this error occuring and wondering whether anyone can assist in resolving

" [User Error] Uncaught TypeError: Argument 3 passed to GridField::__construct() must implement interface SS_List or be null, bool given"
Line 93 in /data/www//framework/forms/gridfield/GridField.php*

This is all in core code, and no modifications to that structure have been made. Im not sure when this began occurring, but hasn’t been any recent changes to the code.

Removing the mods to the CMS Fields doesn’t have any impact on the error.

	public function getCMSFields() {

		$fields = parent::getCMSFields();

// Modifications
}

Trace

* **GridField->__construct(Filled,Filled,,GridFieldConfig_RelationEditor)**

* **ReflectionClass->newInstanceArgs(Array)**
InjectionCreator.php:17
* **InjectionCreator->create(GridField,Array)**
Injector.php:560
* **Injector->instantiate(Array,,prototype)**
Injector.php:869
* **Injector->get(GridField,,Array)**
Injector.php:907
* **Injector->createWithArgs(GridField,Array)**
Object.php:142
* **SS_Object::create(GridField,Filled,Filled,,GridFieldConfig_RelationEditor)**
FormScaffolder.php:167
* **FormScaffolder->getFieldList()**
DataObject.php:2368
* **DataObject->scaffoldFormFields(Array)**
DataObject.php:2407
* **DataObject->getCMSFields()**
MemberYachtJob.php:174
* **MemberYachtJob->getCMSFields()**
GridFieldDetailForm.php:398
* **GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest)**
GridFieldDetailForm.php:304
* **GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest)**
RequestHandler.php:296
* **RequestHandler->handleAction(SS_HTTPRequest,edit)**
RequestHandler.php:208
* **RequestHandler->handleRequest(SS_HTTPRequest,DataModel)**
GridFieldDetailForm.php:102
* **GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest)**
GridField.php:995
* **GridField->handleRequest(SS_HTTPRequest,DataModel)**
RequestHandler.php:230
* **RequestHandler->handleRequest(SS_HTTPRequest,DataModel)**
RequestHandler.php:230
* **RequestHandler->handleRequest(SS_HTTPRequest,DataModel)**

Any tips on disabling the Silverstripe error handling so I can dump values and locate where the error is originating, would be useful aswell.

Check this line.

This can be the result of a query that returns false on specific conditions, so it can be triggered without code changes.

That is a call to:
$fields = parent::getCMSFields();
The trace shows that the error is from the GridList class, which is throwing exception on an insufficient number of parameters. This appears to be core code, and fully generated from a Build?

Removing the entire extension getCMSFields call, and leaving default silverstripe functionality still produces the same error.

That’s impossible: the stack trace must be different, otherwise you have some caching around that keeps the old code alive. Please, provide the stack trace with that line removed: it should be different.

Wow, as mentioned the ERROR (which is the instance where the code is throwing exception) is the same.

[User Error] Uncaught TypeError: Argument 3 passed to GridField::__construct() must implement interface SS_List or be null, bool given

You are correct however, if you change the process that invokes said error, you will alter the Trace.

Trace
GridField->__construct(Filled,Filled,GridFieldConfig_RelationEditor)
ReflectionClass->newInstanceArgs(Array)
InjectionCreator.php:17
InjectionCreator->create(GridField,Array)
Injector.php:564
Injector->instantiate(Array,prototype)
Injector.php:905
Injector->get(GridField,Array)
Injector.php:978
Injector->createWithArgs(GridField,Array)
Object.php:142
SS_Object::create(GridField,Filled,Filled,GridFieldConfig_RelationEditor)
FormScaffolder.php:169
FormScaffolder->getFieldList()
DataObject.php:2368
DataObject->scaffoldFormFields(Array)
DataObject.php:2407
DataObject->getCMSFields()
GridFieldDetailForm.php:398
GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest)
GridFieldDetailForm.php:304
GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest)
RequestHandler.php:296
RequestHandler->handleAction(SS_HTTPRequest,edit)
RequestHandler.php:208
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
GridFieldDetailForm.php:102
GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest)
GridField.php:995
GridField->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:230
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
RequestHandler.php:230
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:151
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:476
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:92
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:383
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:147

The exception is occurring in Silverstripe core code due to the parameters provided, and is not producing any useful information on the Relation or Object + exact parameters causing the issue. What I would like to know is if I can easily disable the exception handling for Silverstripe so I can effectively wrap the routine that is throwing the exception . A Try catch at the levels I’ve attempted around the Traced routines refuses to show an exception message, and allow me to determine which relationship is the issue.

That’s impossible: the stack trace must be different, otherwise you have some caching around that keeps the old code alive. Please, provide the stack trace with that line removed: it should be different.

According to GitHub, the forth parameter of the FormScaffolder call is the relation method, so you have some problems with a relation. Do you have a relation and a method with the same name?

Is your problem solved?