Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Bug Reports
  3. 502 errors when saving a post — broken recursive call in update_thumbnails.php for 'stack' elements

502 errors when saving a post — broken recursive call in update_thumbnails.php for 'stack' elements

Scheduled Pinned Locked Moved Bug Reports
6 Posts 2 Posters 38 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    ujarak
    wrote last edited by
    #1

    Hi,

    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 wp-content/themes/lay/updatejson/update_thumbnails.php, lines 428–444:

    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)
    

    The warnings flood the FastCGI response headers until nginx rejects the response with a 502.

    Bug cause

    update_thumbnail_in_json_recursive() accepts a single $thumb_data array as its third parameter. However, the stack branch calls it passing individual positional arguments instead:

    else if ($array[$i]['type'] == 'stack' ) {
        LayUpdateThumbnails::update_thumbnail_in_json_recursive(
            $array[$i]['cont'], $needsUpdate, $post_id, $permalink, $title,
            $featuredImgId, $featuredImgUrl, $ar, $sizesArr, ...
        );
    }
    

    This means $thumb_data receives the value of $post_id (an integer) inside the recursive call. When the function then tries to unpack $thumb_data['post_id'], $thumb_data['permalink'], etc., PHP fires a warning on every single line of the unpack block.

    For reference, the carousel and elementgrid branches in the same function call it correctly:

    else if ($array[$i]['type'] == 'carousel') {
        LayUpdateThumbnails::update_thumbnail_in_json_recursive(
            $array[$i]['carousel'], $needsUpdate, $thumb_data
        );
    }
    

    Hope this helps. Happy to provide any additional info if needed.

    1 Reply Last reply
    0
    • arminunruhA Offline
      arminunruhA Offline
      arminunruh
      Global Moderator
      wrote last edited by
      #2

      oh yes, will release an update now that fixes this

      1 Reply Last reply
      0
      • U Offline
        U Offline
        ujarak
        wrote last edited by
        #3

        Thanks for the quick response and for looking into it so fast :)

        1 Reply Last reply
        0
        • arminunruhA Offline
          arminunruhA Offline
          arminunruh
          Global Moderator
          wrote last edited by
          #4

          im going to release the update now!

          1 Reply Last reply
          0
          • arminunruhA Offline
            arminunruhA Offline
            arminunruh
            Global Moderator
            wrote last edited by
            #5

            well in a few minutes

            1 Reply Last reply
            1
            • U Offline
              U Offline
              ujarak
              wrote last edited by
              #6

              That's ok, thank you :)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              I also code custom websites or custom Lay features.
              💿 Email me here: 💿
              info@laytheme.com

              Our Web Development company: 100k.studio

              Want to tip me? https://www.paypal.com/paypalme/arminunruh

              Before you post:
              1. When using a WordPress Cache plugin, disable it or clear your cache.
              2. Update Lay Theme and all Lay Theme Addons
              3. Disable all Plugins
              4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

              This often solves issues you might run into

              When you post:
              1. Post a link to where the problem is
              2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
              3. If the problem is difficult to explain, post screenshots / link to a video to explain it
              Online Users
              dmncnD
              dmncn
              damsmigielskiD
              damsmigielski
              B
              beatrizcoias
              Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
              laytheme.com
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Recent
              • Tags
              • Popular
              • Users
              • Search