• Resolved markman641

    (@markman641)


    I recently noticed a glitch with my website where some images on the homepage weren’t being loaded correctly.

    I noticed that the HTML seems to be missing a single quote, which is causing the html to break and not load

    <div class="box-image" style="background-image:url(https://i0.wp.com/www.redroll.com/wp-content/uploads/2019/01/450319678-1.jpeg?resize=700%2C700&ssl=1');""></div>

    Heres the source code from my theme file:
    <div class="box-image" style="background-image:url('<?php echo $box_image[0] ?>');"></div>

    As you can see, there is no opening quote before the link.
    So I went into Minify settings and went to the CSS section and tried turning css minification off. It started working again.

    So i tried to narrow down if its a setting I have within the CSS minification. Tried turning off Preserved comment removal, Line break removal, and tried changing the @import setting. No luck getting it back.

    Also went into the general settings and changing the CSS minifier from Minify to CSS tidy, but still no luck

    It seems the only way to fix it is to disable CSS minification entirely. What’s the deal? how can i whitelist that one line from not being minified?

    • This topic was modified 6 years, 1 month ago by markman641.
    • This topic was modified 6 years, 1 month ago by markman641.
    • This topic was modified 6 years, 1 month ago by markman641.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter markman641

    (@markman641)

    Update:

    So I was able to fix it by removing the quotes around the link anyways.
    I think thats what the minifier was trying to do, strip those quotes, but it messed up and only stripped one of the quotes.

    Also, you might notice in the page code that it added an extra ” out of nowhere for no reason.

    Super strange.

    I also would like an answer on this. didn’t notice same issue. but noticed quotes being removed when minity html enabled. is there any reason quotes being removed? we should have option as it can be problematic if something goes wrong and they barely take few bytes.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    We are aware of the issue and we will be releasing a new update with fixes within a week.

    What happens is:
    w3-total-cache/lib/Minify/Minify/HTML.php line 346:

    $m[2] = preg_replace('/([a-z0-9]=)[\'"]([^\'"\\s=]+)[\'"](?!\\/)/i', '$1$2', $m[2]);
            $m[2] = preg_replace('/([a-z0-9]=)[\'"]([^\'"\\s=]+)[\'"]\\//i', '$1$2 /', $m[2]);
            $m[2] = preg_replace('/([a-z0-9])=[\'"][\'"]/i', '$1', $m[2]);

    should be:

    $m[2] = preg_replace( '/([a-z0-9]=)\'([^\'\\s=]+)\'(\\s|>)(?!\\/)/i', '$1$2$3', $m[2] );
            $m[2] = preg_replace( '/([a-z0-9]=)"([^"\\s=]+)"(\\s|>)(?!\\/)/i', '$1$2$3', $m[2] );
            $m[2] = preg_replace( '/([a-z0-9]=)\'([^\'\\s=]+)\'\\//i', '$1$2 /', $m[2] );
            $m[2] = preg_replace( '/([a-z0-9]=)"([^"\\s=]+)"\\//i', '$1$2 /', $m[2] );
            $m[2] = preg_replace('/([a-z0-9])=\'\'/i', '$1', $m[2]);
            $m[2] = preg_replace('/([a-z0-9])=""/i', '$1', $m[2]);

    This might be related although I do NOT have minification of any kind enabled.

    This:

    <img width="45px" height="45px" src="//pbs.twimg.com/profile_images/741360440551350273/jXa8rLIb_normal.jpg" alt="Tweet Avatar" class="">

    becomes this:

    <img width="45px" height="45pxsrc=//pbs.twimg.com/profile_images/741360440551350273/jXa8rLIb_normal.jpg" alt="Tweet Avatar" />

    I.e. height="45px" src="//pbs.twimg.com... becomes height="45pxsrc=//pbs.twimg.com with W3TC enabled. Issue is fixed completely when W3TC is disabled.

    • This reply was modified 6 years, 1 month ago by arcivanov.
    • This reply was modified 6 years, 1 month ago by arcivanov.
    • This reply was modified 6 years, 1 month ago by arcivanov.
    • This reply was modified 6 years, 1 month ago by arcivanov.
    • This reply was modified 6 years, 1 month ago by arcivanov.
    • This reply was modified 6 years, 1 month ago by arcivanov.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Removing quote from HTML’ is closed to new replies.