Error while localizing communityEventsData in script-loader.php

I'm getting an error in my logs:

NOTICE: PHP message: PHP Warning:  Cannot assign an empty string to a string offset in /usr/share/nginx/wp/wp-includes/class.wp-scripts.php on line 492

So I got the stack trace:

Array
(
    [0] = Array
        (
            [file] = /usr/share/nginx/wp/wp-includes/functions.wp-scripts.php
            [line] = 221
            [function] = localize
            [class] = WP_Scripts
            [type] = -
            [args] = Array
                (
                    [0] = dashboard
                    [1] = communityEventsData
                    [2] = Array
                        (
                            [nonce] = 0c29524bac
                            [cache] = 
                            [time_format] = g:i a
                        )

                )

        )

I think that because the key [cache] is empty, this is generating the warning in class.wp-scripts.php Isn't that all WP core? Their check to skip is if ( ! is_scalar( $value ) ) and before the last update I had changed that to if ( ! is_scalar( $value ) || empty( $value) ) but of course that was overwritten last update. I'm wondering if I'm missing something or if it's a minor oversight in core.

Topic core-modifications core multisite Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.