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 462 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
    U
    ujarak
    wrote on 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
      arminunruhA
      arminunruh
      Global Moderator
      wrote on last edited by
      #2

      oh yes, will release an update now that fixes this

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

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

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

          im going to release the update now!

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

            well in a few minutes

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

              That's ok, thank you :)

              1 Reply Last reply
              0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              Online Users
              J
              j.varela
              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