views:

83

answers:

2

Hello,

In my init I have:

   $contextSwitch   = $this->_helper->getHelper('ForceContext');
   $contextSwitch->addActionContext('favourite-listing', 'json')->initContext();

In my controller method I have:

    public function favouriteListingAction() {

    $newValues = array();

    if (isset($_POST['Playlist']) && is_array($_POST['Playlist'])) {
        foreach ($_POST['Playlist'] as $key => $value) {
            $response = $this->checkAction('Playlist', $value, 0, 1, 'favourite');
            $newValues['Playlist'][$value] = $response;
        }
    }

    if (isset($_POST['Clip']) && is_array($_POST['Clip'])) {
        foreach ($_POST['Clip'] as $key => $value) {
            $response = $this->checkAction('Clip', $value, 0, 1, 'favourite');
            $newValues['Clip'][$value] = $response;
        }
    }
    $this->view->favourites = $newValues;
}

However calling this, returns:

    {"loggedIn":true,"request":{},"response":{"headersSentThrowsException":true},"translate":{},"favourites":{"Clip":{"726":"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","727":
"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","728":"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","729":
"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","730":
"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","731":"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites","732":
"<img src=\"\/design\/images\/icon\/subscribe.png\" \/> Add Clip To Favourites"}}}

As you can see, its adding slashes, which causes issues. Is there away to stop it doing this?

+1  A: 

Possible magic quotes configured on server?

Magic Quotes

ArneRie
A: 

If you don't find your problem you could always just run function stripslashes http://php.net/manual/fr/function.stripslashes.php on the data to strip it of its extra slashes.

Iznogood