• Resolved mizkirsten

    (@mizkirsten)


    I have the basic plugin installed on my local development environment. I’m running on Local server (from WPEngine/Flywheel) in a multisite instance with BuddyPress.

    Multiple PHP warnings, ‘Undefined array key “type”‘ have been printing to my error log. It seems to be coming from the plugin because they stop when I disable it.

    It seems to be connected to something that polls every 10 seconds or so, if that’s helpful. I get two of these warnings roughly every 10 seconds
    ‘[08-Nov-2023 19:29:04 UTC] PHP Warning: Undefined array key “type” in /Users/myname/Local Sites/site-plug/app/public/wp-includes/rest-api.php on line 3076

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author wordplus

    (@wordplus)

    Hi there!

    Will check if I can reproduce this issue.

    Thanks!

    Plugin Author wordplus

    (@wordplus)

    Hi there!

    Just tried to do the same with Local Server, but it does not gives me any warnings.

    Probably you have some other plugins which can be impacting rest api?

    Thread Starter mizkirsten

    (@mizkirsten)

    Hi! Thanks for the quick reply ??

    When I modify the site_interval value in inc/options of the plugin, from 10 to 10000000, the warning fires only once on page load.

    When I reset back to 10 the repeated warnings return every 10 seconds.

    So it does seem that whatever uses the value of site_interval is the cause of the warnings.

    • This reply was modified 1 year ago by mizkirsten.
    Plugin Author wordplus

    (@wordplus)

    Hi there!

    I cant reproduce any warnings, I think you can have other plugin which produces warning, when Better Messages or other plugin accessing rest api. Otherwise I do not know what can be the issue, as I cant reproduce it.

    If you can provide the full PHP error with trace stack, maybe I can understand something more then.

    Thanks!

    Thread Starter mizkirsten

    (@mizkirsten)

    Oof! You’re right ?? It was, of course, my own plugin. Sorry for the confusion!

    Thread Starter mizkirsten

    (@mizkirsten)

    If you’re game, I’d be grateful for any thoughts on how my code is conflicting with Better Messages. I’ve posted the stack trace here:
    https://gist.github.com/MsPseudolus/12e5a9ae98de7f901aee1a542cf6466c

    I’m not able to see here what the problem is. (Everything that’s mine is using the term localapp or local-app.)

    I only get these warnings when both plugins are activated.

    Plugin Author wordplus

    (@wordplus)

    Hi there!

    Not possible to say from the error stack trace.

    Thread Starter mizkirsten

    (@mizkirsten)

    OK, thanks. I appreciate you taking a look ??

    Thread Starter mizkirsten

    (@mizkirsten)

    For anyone in the future who might read this, here was the problem:

    I had used 'type' => 'array', in the wrong place in a call to register_post_meta() .

    I had placed it outside of the args and had a duplicate of it within the args.

    Like so

    register_post_meta(
    'post_type',
    'meta_key_name',
    'type' => 'array,
    array (
    'show_in_rest' => array(
    'schema' => array(
    'items' => array(
    'type' => 'array,
    )
    )
    )
    )
    )

    When I removed it from outside of args (the first instance of it) the warnings stopped.

    • This reply was modified 1 year ago by mizkirsten.
    • This reply was modified 1 year ago by mizkirsten.
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Multiple Undefined array key “type” warnings’ is closed to new replies.