Support » Plugin: WordPress Slider Block Gutenslider » Bug: ValueError: Unknown format specifier “C”

  • Resolved dianfishekqi

    (@dianfishekqi)


    2022-01-09T12:07:42+00:00 CRITICAL Uncaught ValueError: Unknown format specifier “C” in /home/xxx/public/wp-content/plugins/gutenslider/src/blocks/gutenslide/block-front.php:280
    Stack trace:
    #0 /home/xxx/public/wp-content/plugins/gutenslider/src/blocks/gutenslide/block-front.php(280): sprintf()
    #1 /home/xxx/public/wp-includes/class-wp-block.php(221): eedee_gutenslide_dynamic_render_callback()
    #2 /home/xxx/public/wp-includes/class-wp-block.php(211): WP_Block->render()

    • This topic was modified 4 months, 1 week ago by dianfishekqi.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter dianfishekqi

    (@dianfishekqi)

    the problem is that $background_content variable on line 276 is not escaped properly.

    • This reply was modified 4 months, 1 week ago by dianfishekqi.
    Plugin Contributor Gutenberg Slider

    (@gutenbergslider)

    @dianfishekqi sorry for the issue. I assume you are trying to create a video slide? Can you give more information, as we are not yet able to reproduce it, despite your help with the log. Also I assume you are using php8? We went over the lines 276, 280. Where do you see the not properly escaped variable? Maybe I am just blind?

    Thread Starter dianfishekqi

    (@dianfishekqi)

    Hello there,

    Yes I’m using php 8.0, I’ve encounter this issue when one of the colleagues edited a Gutenberg slider after that the edit page would throw a fatal error. He was working on some banners involving a sale therefore he might have used %.

    I’ve noticed that $background_content is being concatenated here, after doing a naive escape with str_replace('%','%%') the page was restored which led me to believe that that was the problem.

     
    $background_div = sprintf(
                '<div class="%2$s">'
                .$background_content
                . '<div class="eedee-background-div__overlay" style="%1$s"></div>'
                . '</div>',
                $background_overlay_style,
                $background_classes
            );
    

    WooCommerce log related with the incident:
    https://pastebin.com/6gZ0YcxB

    • This reply was modified 4 months, 1 week ago by dianfishekqi.
    Thread Starter dianfishekqi

    (@dianfishekqi)

    The same error happened again, I think $background_content is the culprit,
    changing

    $background_div = sprintf(
                '<div class="%2$s">'
                .$background_content
                . '<div class="eedee-background-div__overlay" style="%1$s"></div>'
                . '</div>',
                $background_overlay_style,
                $background_classes
            );

    to

    $background_div = sprintf(
                '<div class="%2$s">'
                . '%3$s'
                . '<div class="eedee-background-div__overlay" style="%1$s"></div>'
                . '</div>',
                $background_overlay_style,
                $background_classes,
                $background_content
            );

    fixed the problem

    Plugin Contributor Gutenberg Slider

    (@gutenbergslider)

    Oh sorry we did not get back to you again. We will fix it in the next release and thank you for the code fix.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.