backdrop-issues icon indicating copy to clipboard operation
backdrop-issues copied to clipboard

PHP notices on the "Debug information" page

Open findlabnet opened this issue 1 year ago • 11 comments

Description of the bug

When visiting admin/reports/debug on site where both version CKEditor module uninstalled, I get PHP notices:

Notice: Undefined index: ckeditor5 in system_get_debug_info() (line 2421 of /core/modules/system/system.admin.inc).

Notice: Trying to access array offset on value of type null in system_get_debug_info() (line 2422 of /core/modules/system/system.admin.inc).

Notice: Trying to access array offset on value of type null in system_get_debug_info() (line 2428 of /core/modules/system/system.admin.inc).

Seems like function filter_formats called from system_get_debug_info() returned wrong (cached?) result.

"Flush all caches" has no effect.

Below is part of var_dump($text_formats) from line 2418:

array(3) {
  ["filtered_html"]=>
  object(stdClass)#52 (8) {
    ["format"]=>
    string(13) "filtered_html"
    ["name"]=>
    string(5) "Basic"
    ["weight"]=>
    int(0)
    ["editor"]=>
    string(9) "ckeditor5"
...

Steps To Reproduce

Visit admin/reports/debug on site where both version CKEditor module uninstalled

Additional information

On an older site I got the same warnings, but about 'ckeditor' instead of 'ckeditor5'.

Add any other information that could help, such as:

  • Backdrop CMS version: 1.28.1
  • Web server and its version: Apache/2.4.59 (Debian)
  • PHP version: 7.4.33
  • Database sever: 5.5.5-10.5.23-MariaDB-0+deb11u1
  • Operating System and its version: Debian GNU/Linux 11.9

findlabnet avatar Jun 29 '24 10:06 findlabnet

That's strange - I usually uninstall CKE (4 and 5), as I use TinyMCE, anyway, but I didn't see that nagging (neither in dblog).

Checked some more sites now - no nagging.

The problem seems related to the filtered_html format? Weird that you (still) get ckeditor5 there.

@findlabnet can you check the json config (on admin/config/development/configuration/single/export)? (Configuration group "Text formats".

Does the value "ckeditor5" show up there, too? Are you using another editor or just none for filtered_html?

indigoxela avatar Jun 29 '24 11:06 indigoxela

Basic:

{
    "_config_name": "filter.format.filtered_html",
    "format": "filtered_html",
    "name": "Basic",
    "weight": 0,
    "editor": "ckeditor5",
    "editor_settings": {
        "image_upload": {
            "status": 1,
            "dimensions": {
                "max_width": "",
                "max_height": ""
            },
            "max_size": null,
            "scheme": "public",
            "directory": "inline-images"
        }
    },
    "filters": {
        "filter_url": {
            "weight": 0,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_html": {
            "weight": 1,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_autop": {
            "weight": 2,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_image_caption": {
            "weight": 4,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_image_align": {
            "weight": 4,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_htmlcorrector": {
            "weight": 10,
            "status": 1,
            "module": "filter",
            "settings": []
        }
    },
    "cache": true,
    "status": 1
}

Raw HTML:

{
    "_config_name": "filter.format.full_html",
    "format": "full_html",
    "name": "Raw HTML",
    "weight": 1,
    "editor": null,
    "filters": {
        "filter_url": {
            "weight": 0,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_autop": {
            "weight": 1,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_image_caption": {
            "weight": 4,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_image_align": {
            "weight": 4,
            "status": 1,
            "module": "filter",
            "settings": []
        },
        "filter_htmlcorrector": {
            "weight": 10,
            "status": 1,
            "module": "filter",
            "settings": []
        }
    },
    "cache": true,
    "status": 1
}

This site on local dev, without any editors. On the second (old one), BUEditor is used for Full HTML.

findlabnet avatar Jun 29 '24 11:06 findlabnet

That's odd - I mean the filtered_html format.

Hm. Shouldn't you also see some nagging on admin/config/content/formats/filtered_html then?

If you save the Basic format, does the nagging go away after that?

My suspicion: you uninstalled the CKEditor module, but the settings for the filtered_html format stayed untouched. I'm not sure, if this is desired behavior, though. Personally, I switch the format setting to Tiny, before I uninstall core's editor module(s).

indigoxela avatar Jun 29 '24 11:06 indigoxela

Your suspicion is right, after saving the "Basic" format without any changes, the notices are gone. And the config is now: (roles have also been added)

{
    "_config_name": "filter.format.filtered_html",
    "format": "filtered_html",
    "name": "Basic",
    "weight": 0,
    "editor": "",
    "editor_settings": [],
    "filters": {
        "filter_image_caption": {
            "status": 1,
            "weight": 4,
            "module": "filter",
            "settings": []
        },
        "filter_autop": {
            "status": 1,
            "weight": 2,
            "module": "filter",
            "settings": []
        },
        "filter_url": {
            "status": 1,
            "weight": 0,
            "settings": {
                "filter_url_length": 72
            },
            "module": "filter"
        },
        "filter_htmlcorrector": {
            "status": 1,
            "weight": 10,
            "module": "filter",
            "settings": []
        },
        "filter_html_escape": {
            "status": 0,
            "weight": -10,
            "module": "filter",
            "settings": []
        },
        "filter_image_align": {
            "status": 1,
            "weight": 4,
            "module": "filter",
            "settings": []
        },
        "filter_html": {
            "status": 1,
            "weight": 1,
            "settings": {
                "allowed_html": "<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3> <h4> <h5> <p> <br> <img> <figure> <figcaption>"
            },
            "module": "filter"
        }
    },
    "cache": true,
    "status": 1,
    "roles": {
        "anonymous": "anonymous",
        "authenticated": "authenticated",
        "editor": "editor",
        "administrator": "administrator"
    }
}

findlabnet avatar Jun 29 '24 11:06 findlabnet

...after saving the "Basic" format without any changes, the notices are gone.

Many thanks for verifying. The big question is now: is that uninstall behavior as expected - or a bug? I mean: when uninstalling the CKEditor(5) module, should there be some format cleanup in an uninstall hook, or not?

indigoxela avatar Jun 29 '24 12:06 indigoxela

If the installer set something, the uninstaller should remove it. Shouldn't it?

findlabnet avatar Jun 29 '24 12:06 findlabnet

If the installer set something, the uninstaller should remove it. Shouldn't it?

If it were the module (on install) I'd say, yes it has to clean up on uninstall. But the case is a bit trickier here, the format's editor setting ships with the standard profile, not the editor module. And the settings form ships (at least partly) with the Filter module :thinking:

But given, the setting is "dead" without the module. And the only outcome is PHP nagging on some pages... Maybe I have to think that over again, but I'm leaning towards uninstall hook in the ckeditor5 module, that loops over text formats for some (cautious) cleanup.

indigoxela avatar Jun 29 '24 13:06 indigoxela

By the way (and for the record) on the old site "ckeditor" was defined for unused input format and was not a problem before core got the new feature (debug info page).

findlabnet avatar Jun 29 '24 13:06 findlabnet

Just finished installing 1.30.0, and seeing this error in my log. I have ckeditor5 installed and ckeditor uninstalled.

Here's the errors generated when visiting /admin/reports/debug:

Warning: Undefined array key "ckeditor" in system_get_debug_info() (line 2421 of /home/sapaseniors/sapsbd/docroot/core/modules/system/system.admin.inc).
Warning: Trying to access array offset on null in system_get_debug_info() (line 2422 of /home/sapaseniors/sapsbd/docroot/core/modules/system/system.admin.inc).
Warning: Trying to access array offset on null in system_get_debug_info() (line 2428 of /home/sapaseniors/sapsbd/docroot/core/modules/system/system.admin.inc).

Wylbur avatar Jan 18 '25 23:01 Wylbur

Just finished installing 1.30.0, and seeing this error in my log. I have ckeditor5 installed and ckeditor uninstalled.

That seems odd. This is a fresh install?

The only explanation could be that there's a format still using "ckeditor", which can't be the case on fresh installs as of 1.27.

@Wylbur on admin/config/content/formats you only see one format using an editor, and that's CKE5?

I can't reproduce on a fresh install, so there might be something interfering on your install we're not aware of. Can you check your active config folder? Are there some leftover filter.format.*.json from a previous install?

indigoxela avatar Jan 19 '25 07:01 indigoxela

Very sorry, I was not installing, I was updating!

Wylbur avatar Jan 19 '25 18:01 Wylbur