'php echo remove slashes from url [duplicate]

I have experienced a strange problem with the slideshow on our corporate site and i haven't figured what is whong. After Joomla updated to 3.7.2 in place where php echo the url i have the following:

Instead of:

style="background-image: url("images/sliders/slide-1.jpg");

It outputs:

style="background-image: url(" images sliders slide-1.jpg");

The script for the slideshow has the following Vars:

$ctaImg = $helper->get('img');

$ctaBackground  = 'background-image: url("'.$ctaImg.'"); background-attachment: fixed; background-repeat: no-repeat; background-size: cover;';

and the line that applies the img on background-image url is:

<div class="acm-cta style-5 <?php echo $helper->get('style'); ?> <?php if($ctaImg): echo 'bg-image-large'; endif; ?>" <?php if($ctaImg): echo 'style="'.$ctaBackground.'"'; endif; ?> >

Using var-dump i have the following output:

<!-- Var1: string(33) "images/sliders/slide-1.jpg"
 Var2: string(143) "background-image: url("images/sliders/slide-1.jpg"); background-attachment: fixed; background-repeat: no-repeat; background-size: cover;"
 -->

Elements:

screenshot - Elements

Sources:

screenshot - Sources

In Developer Tools in Chrome at Elements tab, slashes are missing from url but in Sources the url is correct. It drives me crazy....



Solution 1:[1]

To fix that you just need to remove quotes from background-image: url("")

In inspector your code looks:

style="background-image: url("/images/sliders/slide-1.jpg");"

and should

style="background-image: url(/images/sliders/slide-1.jpg);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arek Szczerba