FTR explicitly adding slashes in design-pattern

I think this might be a bug. I’m using a self-hosted FTR.

Everytime i save the following design-pattern:

title://div[contains(@id, “ContentContainer”)]/h3
body://div[contains(@id,“ContentContainer”)]

After save, the output changes to this:

title://div[contains(@id, “ContentContainer”)]/h3
body://div[contains(@id,“ContentContainer”)]

I sent an e-mail on this too coz I really need this to be fixed :frowning:

Hi Mubashar, thanks for the report.

Some hosts have magic quotes enabled, which causes this behaviour. We forgot to check for this in edit-patterns.php, we’ll do this in the next release.

To fix, follow the steps below:

  1. Open admin/edit-patterns.php
  2. Find this line (near the beginning of the file): require_once ‘…/libraries/content-extractor/SiteConfig.php’;
  3. Before that line, paste the following code:

if (get_magic_quotes_gpc()) {
$process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k => $v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = stripslashes($v);
}
}
}
unset($process);
}

  1. Save the file

The code comes from here: http://docs.php.net/manual/en/security.magicquotes.disabling.php

This will not fix site config files which you’ve editing in this interface and which have had slashes added, but it should prevent slashes being added in future edits.

Sorry for the inconvenience. Let us know if you have any trouble with this.

The white space hasn’t been preserved in the code snippet above, so might be best to copy from http://docs.php.net/manual/en/security.magicquotes.disabling.php (See Example #2 Disabling magic quotes at runtime)

Thanks! That solved the problem! I was cracking my head as of why the stips were not working. Now its all running perfectly!

This is one awesome application really!

Mubashar

Thanks for the update - glad to hear it’s working well now. :slight_smile: