<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I've been getting 502 errors when saving certain projects in the WordPress admin. After digging into the nginx error logs I traced the issue to a PHP warning cascade in <code>wp-content/themes/lay/updatejson/update_thumbnails.php</code>, lines 428–444:</p>
<pre><code>PHP Warning: Trying to access array offset on int in update_thumbnails.php on line 428
PHP Warning: Trying to access array offset on int in update_thumbnails.php on line 429
... (repeats for every line in the unpack block)
</code></pre>
<p dir="auto">The warnings flood the FastCGI response headers until nginx rejects the response with a 502.</p>
<p dir="auto"><strong>Bug cause</strong></p>
<p dir="auto"><code>update_thumbnail_in_json_recursive()</code> accepts a single <code>$thumb_data</code> array as its third parameter. However, the <code>stack</code> branch calls it passing individual positional arguments instead:</p>
<pre><code class="language-php">else if ($array[$i]['type'] == 'stack' ) {
    LayUpdateThumbnails::update_thumbnail_in_json_recursive(
        $array[$i]['cont'], $needsUpdate, $post_id, $permalink, $title,
        $featuredImgId, $featuredImgUrl, $ar, $sizesArr, ...
    );
}
</code></pre>
<p dir="auto">This means <code>$thumb_data</code> receives the value of <code>$post_id</code> (an integer) inside the recursive call. When the function then tries to unpack <code>$thumb_data['post_id']</code>, <code>$thumb_data['permalink']</code>, etc., PHP fires a warning on every single line of the unpack block.</p>
<p dir="auto">For reference, the <code>carousel</code> and <code>elementgrid</code> branches in the same function call it correctly:</p>
<pre><code class="language-php">else if ($array[$i]['type'] == 'carousel') {
    LayUpdateThumbnails::update_thumbnail_in_json_recursive(
        $array[$i]['carousel'], $needsUpdate, $thumb_data
    );
}
</code></pre>
<p dir="auto">Hope this helps. Happy to provide any additional info if needed.</p>
]]></description><link>https://laythemeforum.com/topic/11778/502-errors-when-saving-a-post-broken-recursive-call-in-update_thumbnails.php-for-stack-elements</link><generator>RSS for Node</generator><lastBuildDate>Mon, 06 Apr 2026 02:40:56 GMT</lastBuildDate><atom:link href="https://laythemeforum.com/topic/11778.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 10 Mar 2026 12:03:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements on Wed, 11 Mar 2026 09:35:22 GMT]]></title><description><![CDATA[<p dir="auto">That's ok, thank you :)</p>
]]></description><link>https://laythemeforum.com/post/46692</link><guid isPermaLink="true">https://laythemeforum.com/post/46692</guid><dc:creator><![CDATA[ujarak]]></dc:creator><pubDate>Wed, 11 Mar 2026 09:35:22 GMT</pubDate></item><item><title><![CDATA[Reply to 502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements on Wed, 11 Mar 2026 08:56:33 GMT]]></title><description><![CDATA[<p dir="auto">well in a few minutes</p>
]]></description><link>https://laythemeforum.com/post/46681</link><guid isPermaLink="true">https://laythemeforum.com/post/46681</guid><dc:creator><![CDATA[arminunruh]]></dc:creator><pubDate>Wed, 11 Mar 2026 08:56:33 GMT</pubDate></item><item><title><![CDATA[Reply to 502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements on Wed, 11 Mar 2026 08:21:38 GMT]]></title><description><![CDATA[<p dir="auto">im going to release the update now!</p>
]]></description><link>https://laythemeforum.com/post/46680</link><guid isPermaLink="true">https://laythemeforum.com/post/46680</guid><dc:creator><![CDATA[arminunruh]]></dc:creator><pubDate>Wed, 11 Mar 2026 08:21:38 GMT</pubDate></item><item><title><![CDATA[Reply to 502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements on Tue, 10 Mar 2026 12:15:24 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the quick response and for looking into it so fast :)</p>
]]></description><link>https://laythemeforum.com/post/46676</link><guid isPermaLink="true">https://laythemeforum.com/post/46676</guid><dc:creator><![CDATA[ujarak]]></dc:creator><pubDate>Tue, 10 Mar 2026 12:15:24 GMT</pubDate></item><item><title><![CDATA[Reply to 502 errors when saving a post — broken recursive call in update_thumbnails.php for &#x27;stack&#x27; elements on Tue, 10 Mar 2026 12:08:30 GMT]]></title><description><![CDATA[<p dir="auto">oh yes, will release an update now that fixes this</p>
]]></description><link>https://laythemeforum.com/post/46673</link><guid isPermaLink="true">https://laythemeforum.com/post/46673</guid><dc:creator><![CDATA[arminunruh]]></dc:creator><pubDate>Tue, 10 Mar 2026 12:08:30 GMT</pubDate></item></channel></rss>