Skip to content
Permalink
Browse files

Only quote User object parms, not other Raw properties

  • Loading branch information...
nwsw committed Jan 19, 2016
1 parent e645777 commit a7aa3ab410b11e072b1bc0f408a78aff67ac2205
Showing with 11 additions and 4 deletions.
  1. +4 −1 lib/obj_NWC2ClipItem.inc
  2. +7 −3 nwsw_TestLib.php
@@ -101,7 +101,10 @@ function ReconstructClipText()
if (is_string($v)) {
// First encode all but '|' as cslashes, then convert \ and | to special combinations
$v2 = str_replace(array('\\\\','|'), array('\]','\}'),addcslashes($v,"\r\n\t\\\"\'"));
if (($c == NWC2OPT_TEXT) || (($c == NWC2OPT_RAW) && preg_match('/[\s"\'\|\\\\]/',$v2)))
if ($c == NWC2OPT_TEXT)
$s .= "\"$v2\"";
else if (!empty($this->UserType) && preg_match('/[\s"\'\|\\\\]/',$v2))
// this is not really necessary, but is done to match NWC behaviour
$s .= "\"$v2\"";
else
$s .= $v2;
@@ -5,9 +5,13 @@
foreach ($clip->Items as $item) {
$o = new NWC2ClipItem($item);
echo "Ref: $item";
echo "New: ".$o->ReconstructClipText()."\n";
unset($o);
if ($o->IsContextInfo()) continue;
$origLine = trim($item);
$newLine = $o->ReconstructClipText();
if ($newLine != $origLine) echo "Ref: $origLine\nNew: $newLine\n\n";
}
$usermsg = <<<__EOMSG

0 comments on commit a7aa3ab

Please sign in to comment.
You can’t perform that action at this time.