<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php &#8211; richliu&#039;s blog</title>
	<atom:link href="https://richliu.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://richliu.com</link>
	<description>Linux, 工作, 生活, 家人</description>
	<lastBuildDate>Wed, 29 May 2024 02:19:54 +0000</lastBuildDate>
	<language>zh-TW</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>WordPress Fatal error: Uncaught TypeError: count()</title>
		<link>https://richliu.com/2024/05/29/5982/wordpress-fatal-error-uncaught-typeerror-count/</link>
					<comments>https://richliu.com/2024/05/29/5982/wordpress-fatal-error-uncaught-typeerror-count/#respond</comments>
		
		<dc:creator><![CDATA[richliu]]></dc:creator>
		<pubDate>Wed, 29 May 2024 02:13:12 +0000</pubDate>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://richliu.com/?p=5982</guid>

					<description><![CDATA[<p>Shorter message: Fatal error: Uncaught TypeError: count [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/05/29/5982/wordpress-fatal-error-uncaught-typeerror-count/">WordPress Fatal error: Uncaught TypeError: count()</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<span id="more-5982"></span>



<p>Shorter message:</p>



<pre class="wp-block-preformatted">Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, false given in formatting.php</pre>



<h2 class="wp-block-heading">Conclusion </h2>



<p>Root cause is WordPress uses the regular expression to convert content text smilies to images. It will exhaust the php pcre library backtrack quickly. Especially when the images in the the article over 500. </p>



<p>Just keep the images number under 500 or separate&nbsp; it into several articles. </p>



<p>if unfortunately, it happend, add &#8220;pcre.backtrack_limit=1000000000&#8221; to php.ini and restart website, it might make it work again, would be very very very slow to load the page. </p>



<p>If still cannot solve this problem, or too slow, probably use the number &#8220;pcre.backtrack_limit=10000000&#8221; can make it work. because default value is not so big like, when it can edit the article again, just remove some images can make it work. </p>



<h2 class="wp-block-heading">How to Get the debug message? </h2>



<p>Enable the debug in the wp-config.php, turn on following messages in the file. </p>



<pre class="wp-block-preformatted">define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true );
</pre>



<p>Or check the web server error log. <br />Original Message</p>



<pre class="wp-block-preformatted">Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, false given in formatting.php

PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, false given in /var/www/htdocs/wp-includes/formatting.php:3507\nStack trace:\n#0 /var/www/htdocs/wp-includes/class-wp-hook.php(324): convert_smilies()\n#1 /var/www/htdocs/wp-includes/plugin.php(205): WP_Hook-&gt;apply_filters()\n#2 /var/www/htdocs/wp-content/plugins/seo-by-rank-math/includes/modules/links/class-links.php(171): apply_filters()\n#3 /var/www/htdocs/wp-content/plugins/seo-by-rank-math/includes/modules/links/class-links.php(59): RankMath\\Links\\Links-&gt;process()\n#4 /var/www/htdocs/wp-includes/class-wp-hook.php(326): RankMath\\Links\\Links-&gt;save_post()\n#5 /var/www/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook-&gt;apply_filters()\n#6 /var/www/htdocs/wp-includes/plugin.php(517): WP_Hook-&gt;do_action()\n#7 /var/www/htdocs/wp-includes/post.php(4828): do_action()\n#8 /var/www/htdocs/wp-includes/post.php(4930): wp_insert_post()\n#9 /var/www/htdocs/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(880): wp_update_post()\n#10 /var/www/htdocs/wp-includes/rest-api/class-wp-rest-server.php(1230): WP_REST_Posts_Controller-&gt;update_item()\n#11 /var/www/htdocs/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server-&gt;respond_to_request()\n#12 /var/www/htdocs/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server-&gt;dispatch()\n#13 /var/www/htdocs/wp-includes/rest-api.php(428): WP_REST_Server-&gt;serve_request()\n#14 /var/www/htdocs/wp-includes/class-wp-hook.php(324): rest_api_loaded()\n#15 /var/www/htdocs/wp-includes/class-wp-hook.php(348): WP_Hook-&gt;apply_filters()\n#16 /var/www/htdocs/wp-includes/plugin.php(565): WP_Hook-&gt;do_action()\n#17 /var/www/htdocs/wp-includes/class-wp.php(418): do_action_ref_array()\n#18 /var/www/htdocs/wp-includes/class-wp.php(813): WP-&gt;parse_request()\n#19 /var/www/htdocs/wp-includes/functions.php(1336): WP-&gt;main()\n#20 /var/www/htdocs/wp-blog-header.php(16): wp()\n#21 /var/www/htdocs/index.php(17): require('...')\n#22 {main}\n  thrown in /var/www/htdocs/wp-includes/formatting.php</pre>



<p>ref.<br /><a href="https://wordpress.org/support/topic/fatal-error-uncaught-typeerror-count-3/" target="_blank" rel="noopener">Fatal error: Uncaught TypeError: count():</a></p>
<p>The post <a rel="nofollow" href="https://richliu.com/2024/05/29/5982/wordpress-fatal-error-uncaught-typeerror-count/">WordPress Fatal error: Uncaught TypeError: count()</a> appeared first on <a rel="nofollow" href="https://richliu.com">richliu&#039;s blog</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://richliu.com/2024/05/29/5982/wordpress-fatal-error-uncaught-typeerror-count/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
