Make WordPress Core

Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#46050 closed defect (bug) (reported-upstream)

blocks.php - Invalid argument supplied for foreach()

Reported by: anonymized_16712923's profile anonymized_16712923 Owned by:
Milestone: Priority: normal
Severity: critical Version: 5.0
Component: Editor Keywords:
Focuses: Cc:

Description

I'm getting following error after upgrading to WP 5.0.3:

Invalid argument supplied for foreach() in /wp-includes/blocks.php on line 183\n

As a result - output HTML is corrupted, some letters and words disappear in HTML resulting output.

Code statement which generating error:

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

I'm using PHP 7.2.13 and MariaDB 10.3.8. Disabling all plugins and using default WP 5.0 theme - not helped at all.

I tested it on PHP 5.6.39 and PHP 7.1.25 - all works fine. Bug appears on PHP 7.2.13 only.

Change History (7)

#1 @anonymized_16712923
6 years ago

#45692 was marked as a duplicate.

#2 follow-up: @pento
6 years ago

  • Keywords reporter-feedback added
  • Version changed from 5.0.3 to 5.0

Thank you for the bug report, @filosofem!

Could you attach a copy of the raw post content to this ticket? A copy directly from the database would be preferable. If you're not sure how to do that, you can open it in the block editor, click the options menu on the top right of the editor screen, and select the "Code Editor" option.

#3 in reply to: ↑ 2 @anonymized_16712923
6 years ago

Replying to pento:

Thank you for the bug report, @filosofem!

Could you attach a copy of the raw post content to this ticket? A copy directly from the database would be preferable. If you're not sure how to do that, you can open it in the block editor, click the options menu on the top right of the editor screen, and select the "Code Editor" option.

Sure, raw post content looks as expected. Problem happens on outputting/rendering raw content into HTML:

<!-- wp:paragraph -->
<p>Today, more than 7 billion people live in the world. The first live richly and luxuriously, the second - representatives of the middle class, and still others live poorly. The distribution of wealth in the world is not in favor of the majority of the population. Almost all world resources belong to a small part of the inhabitants of the planet Earth. Is this a fair allocation of resources?</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>The pyramid of the distribution of world wealth</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>According to the Global Wealth Report 2018 research report from the Swiss company Credit Suisse, world wealth is estimated at $317 trillion. This amount consists of tangible (real estate, cars and other valuable property) and financial (securities, deposits, retirement savings, etc.) assets less credits and debts. The number of adult working population in the world is 5 billion.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The distribution of wealth in the world looks like a pyramid as follows:<br>
</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":40,"align":"center","className":"wp-image-39 size-full"} -->
<div class="wp-block-image wp-image-39 size-full"><figure class="aligncenter"><img src="https://eldarinvest.com/wp-content/uploads/2019/01/global-wealth-pyramid.png" alt="The global wealth pyramid" class="wp-image-40"/><figcaption>Figure 1: Distribution of world wealth among the working population</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:table -->
<table class="wp-block-table"><thead><tr><th>Group number</th><th>Wealth range (K)</th><th>Number of people (M)</th><th>% of the total number of people</th><th>Wealth (T)</th><th>% of total wealth</th><th>Average wealth (K)</th></tr></thead><tbody><tr><td>1</td><td>&gt; $1,000</td><td>42</td><td>0.84%</td><td>$142.00</td><td>44.78%</td><td>$3,380.95</td></tr><tr><td>2</td><td>$100 – $1,000</td><td>436</td><td>8.68%</td><td>$124.70</td><td>39.33%</td><td>$286.01</td></tr><tr><td>3</td><td>$10 – $100</td><td>1,335</td><td>26.57%</td><td>$44.20</td><td>13.94%</td><td>$33.11</td></tr><tr><td>4</td><td>&lt; $10</td><td>3,211</td><td>63.91%</td><td>$6.20</td><td>1.96%</td><td>$1.93</td></tr><tr><td>5</td><td>&gt; $0</td><td>5,024</td><td>100.00%</td><td>$317.10</td><td>100.00%</td><td>$63.12</td></tr></tbody></table>
<!-- /wp:table -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>44.78% of world wealth is concentrated in the hands of 0.84%</strong> of financially literate people. These are the richest people with an average wealth of $3.38 million per capita. In their hands - almost half of world wealth.</li><li>Another <strong>8.68% of people own 39.33% of wealth</strong>. The average welfare of these people is $286 thousand per capita. To get into this group is relatively easy and quite capable of everyone.</li><li>Next come <strong>26.57% of the middle class, owning 13.94% of wealth</strong>. The average welfare of the middle class is $33.1 thousand per capita.</li><li>Finally, <strong>63.91% of people are satisfied with 1.96% of wealth</strong>, living in poverty. These are financially illiterate people with an average wealth of $1.93 thousand per capita. This category forms the basis of the pyramid of distribution of world wealth.</li></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>The higher the level of individual welfare, the smaller the number of such individuals. There are fewer billionaires than millionaires and fewer millionaires than middle class, etc.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>The first 2 groups total 9.51% of people owning 84.11% of world wealth. These are the realities of the modern world. This distribution persists for several decades, changing only slightly.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>The distribution of world wealth among millionaires</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>The forty two million richest people are many or few? In relative terms, it is small (0.84% of the world population), in absolute terms - a lot (42 million, the amount is comparable with the population of a rather big country).</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Let us consider in detail the top of the pyramid of wealth distribution in a world where there are the richest people with wealth of $1 million. Millionaires also have a hierarchy:</p>
<!-- /wp:paragraph -->

<!-- wp:image {"id":42,"align":"center","className":"wp-image-41 size-full"} -->
<div class="wp-block-image wp-image-41 size-full"><figure class="aligncenter"><img src="https://eldarinvest.com/wp-content/uploads/2019/01/global-wealth-pyramid-among-millionaires.png" alt="The global wealth pyramid among millionaires" class="wp-image-42"/><figcaption>Figure 2: Distribution of world wealth among millionaires</figcaption></figure></div>
<!-- /wp:image -->

<!-- wp:table -->
<table class="wp-block-table"><thead><tr><th>Group number</th><th>Wealth range (M)</th><th>Number of millionaires (K)</th><th>% of the total number of millionaires</th><th>% of the total number of people</th></tr></thead><tbody><tr><td>1</td><td>&gt; $50</td><td>149.89</td><td>0.36%</td><td>0.0030%</td></tr><tr><td>2</td><td>$10 – $50</td><td>1,631.46</td><td>3.87%</td><td>0.0325%</td></tr><tr><td>3</td><td>$5 – $10</td><td>3,285.95</td><td>7.79%</td><td>0.0654%</td></tr><tr><td>4</td><td>$1 – $5</td><td>37,087.95</td><td>87.98%</td><td>0.7382%</td></tr><tr><td>5</td><td>&gt; $1</td><td>42,155.25</td><td>100.00%</td><td>0.8391%</td></tr></tbody></table>
<!-- /wp:table -->

<!-- wp:list {"ordered":true} -->
<ol><li><strong>149.89 thousand persons (0.36% of the number of millionaires) have a wealth of more than $50 million</strong>. They are representatives of the world elite. Billionaires, oligarchs, big businessmen, investors and politicians. To get into this small elite group is very difficult.</li><li><strong>1.63 million people (3.87%) own from $10 to $50 million</strong>.</li><li><strong>3.29 million people (7.79%) own from $5 to $10 million</strong>. A sort of “middle class” of millionaires.</li><li>Finally, <strong>37.09 million (87.98%) have wealth from $1 to $5 million</strong>. This large group is 7.32 times more than the first 3 groups combined. Getting into this group is not as difficult as it seems.</li></ol>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>A person will fall into the top of the pyramid of wealth distribution in the world, becoming wealthy, if he sincerely wants it, making efforts and acting. Competition is not terrible, treat it as a challenge, a game and sport.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>To get into the group of millionaires with wealth from $1 to $5 million, becoming a citizen of an “elite country” is within everyone’s power. It is even easier to get into the "country" of representatives of the class above the average with a welfare from $100 thousand to $1 million. There are 436 million such people in the world, more than the population of the USA.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Moving toward these goals, rising from level to level of the pyramid of distribution of world wealth, should be resolutely and gradually, starting small. In any case, it will turn out to significantly improve the financial health and social status. History knows many examples when people chose out of poverty, becoming rich, or at least financially independent.</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>It’s not your fault if you were born poor. But it's definitely your fault if you stay poor until the end of your days<cite>Bill Gates</cite></p><cite>Bill Gates</cite></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p>It's hard not to agree with this quote. Calculate at what level the pyramid of wealth distribution in the world is you. Are your property and savings estimated at least 10 thousand dollars?</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>You will have an interesting fascinating journey to the heights of the pyramid of the distribution of world wealth, if you are not afraid of competition and are ready to act to get rich and win your own place in the global hierarchy.</p>
<!-- /wp:paragraph -->

#4 @desrosj
5 years ago

  • Keywords reporter-feedback removed

#5 @desrosj
5 years ago

  • Keywords reporter-feedback close added

@filosofem are you still experiencing this issue?

I have done some testing with 5.0.3 and 5.1 but I have been unable to reproduce. I tested on PHP 7.3 and 7.2.15.

Marking this a candidate for closure as worksforme, unless you are still experiencing this.

#6 @desrosj
5 years ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

I'm going to close this out because I am not able to reproduce the issue and a lack of reporter feedback.

@filosofem if you are still experiencing this issue and can provide more details that others can use to reproduce, please do reopen.

#7 @SergeyBiryukov
5 years ago

  • Resolution changed from worksforme to reported-upstream

This is caused by mbstring.func_overload PHP setting, see the upstream issue for more details.

Note: See TracTickets for help on using tickets.