Gutenberg: Warning: Invalid argument supplied for foreach() in /wp-includes/blocks.php on line 183

Created on 7 Dec 2018  ·  15Comments  ·  Source: WordPress/gutenberg

After updating to the fifth version of WordPress, such an error appeared on all posts. (see screenshot) I turned off the new editor and switched to the classic one.
2018-12-07_12-02-07

https://orthodoxchurch.ru/tolkovanie-na-bytie-v-videoformate-glava-1/

[Type] WP Core Bug

Most helpful comment

Hello )
in all posts in a classic editor switch to plain editor
and remove "<!-- wp:paragraph -->" and all tegs with <!-- /wp:tegs -->

RUS:
Всем привет!
Я удалил в ручном режиме во всех постах<!-- wp:тэг-->
В классическом редакторе переключив на текст.
Ошибка пропала.
Всем удачи!

All 15 comments

Hi @dimitrisindaryov,

Thanks for the report.

Based on the PHP error notice, it looks like WP_Block_Type_Registry::get_instance()->get_all_registered() may be failing to return an array.

https://github.com/WordPress/WordPress/blob/5.0-branch/wp-includes/blocks.php#L106-L107

I'm curious why this would be the case though, because WP_Block_Type_Registry's internal class variables can't be modified by plugins.

Can you share which plugins you're running? Also, have you tried deactivating each plugin one by one to see if the PHP error notice might be related to one of them?

Accelerated Mobile Pages
Akismet Anti-Spam
All In One SEO Pack
All In One WP Security
AntiVirus
Bg Bible References
Classic Editor
Contact Form 7
Cyclone Slider
Easy WP Meta Description
Elementor
Google Analytics Dashboard for WP (GADWP)Автор: ExactMetrics \| Детали
Google Analytics for WordPress by MonsterInsights
HayyaBuild
ImageRecycle pdf & image compression
iThemes Security
MailChimp для WordPress
Meta Description
Meta Tags Generator
Newsletter - Archive
Orbit Fox Companion
Pageviews
Popups, Lead Forms, Surveys, Live Chats WordPress Plugin - GetSiteControl
Post Views Counter
Redirection
Responsible
Security by CleanTalkGet
SEO Bulk Editor
Slide Anything - Responsive Content / HTML Slider and CarouselSimon Edge \| Детали
Smart Slider 3
Subscribe2
Webcraftic Clearfy
Webcraftic Robin image optimizer
Webcraftic Скрыть страницу логина
WordPress Related Posts
WP Fastest Cache
WP Featherlight
WP Meta SEO
WP Speed of Light
WP Super Cache
WP Translitera
WP-PageNavi
WP-PostRatings
WP-PostViews
Yandex.Metrika
Yet Another Stars Rating
YouTube
YouTube Embed
Мобильное меню
Шорткоды
Яндекс.Дзен.
Яндекс.Поделиться
Яндекс.Турбо

☝🏻 My plugins

This happened when your new editor turned on for the fifth version of WordPress.

@dimitrisindaryov Have you tried deactivating each plugin one by one to see if the PHP error notice might be related to one of them?

I turned off all the plugins. Nothing helps.

Hellow!
I have same problem 2 web sites. (This happened when your new editor turned on for the fifth version of WordPress.)
I dont have plugins (on test site template is stock)
Please help!

Hi.
I have just installed WP 5.0.3 to my local environment. It's a clean setup with default settings (twentynineteen theme, no plugins working, no posts). And I have the same error.

Hello )
in all posts in a classic editor switch to plain editor
and remove "<!-- wp:paragraph -->" and all tegs with <!-- /wp:tegs -->

RUS:
Всем привет!
Я удалил в ручном режиме во всех постах<!-- wp:тэг-->
В классическом редакторе переключив на текст.
Ошибка пропала.
Всем удачи!

I'm having the same issue. I found that it happens only on PHP 7.2. Do you using this version? Try to rollback to PHP 7.1 or older. and your problem will be gone.

Сделал проверку и ошибка ушла:

if ( is_array( $block['innerContent'] ) ) {
            foreach ( $block['innerContent'] as $chunk ) {
            $block_content .= is_string( $chunk ) ? $chunk : render_block( $block['innerBlocks'][ $index++ ] );
        }
    }

This Code has moved to Core and is not maintained in the plugin anymore. Anyone willing to create a trac ticket instead?

Tracked this down to an issue with WP_Block_Parser, which is still maintained as an external package, per https://core.trac.wordpress.org/ticket/45309. Let's continue the discussion in #13655.

Thanks @SergeyBiryukov

Was this page helpful?
0 / 5 - 0 ratings