Error message: PHP Fatal error: Uncaught TypeError ... Argument #2 ($data) must be of type array, null given

|

Table of Contents

Problem

When attempting to activate Borlabs Cookie, the following error message is displayed:

Uncaught TypeError: Borlabs\Cookie\System\Script\BorlabsCookieGlobalsService::addProperty(): Argument #2 ($data) must be of type array, null given, called

Cause

Borlabs Cookie attempts to load WordPress's default CodeMirror editor by using the wp_enqueue_code_editor() function.

Under normal circumstances, this function should return an array. In this case, however, it returns null, which results in a TypeError.

Solution

Since WordPress 4.9.0, CodeMirror has been included as a standard component of WordPress. If the wp_enqueue_code_editor() function does not return the expected array, this indicates a problem. In most cases, the issue is caused by another plugin or the active theme.

To identify the source of the problem, we recommend deactivating all other plugins and temporarily switching to a default WordPress theme.

If the issue no longer occurs afterward, reactivate the plugins one at a time and test after each activation. This will allow you to systematically identify the plugin or theme responsible for the issue.

Was this article helpful?

Helpful
Not helpful

Couldn't find the answer you were looking for? We're happy to help.