From d497fbf67182e4e7cb8758ac99b59f45b4931301 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 15 Sep 2007 00:48:11 +0000 Subject: [PATCH] elofgren: VAR FIXES: Add some needed issets() and variable initializations to fix a lot of warnings when comparing 2 versions of a page. (merged from branches/gsoc) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41844 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/Diff.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/code/Diff.php b/code/Diff.php index d935db33..1abc4f4a 100755 --- a/code/Diff.php +++ b/code/Diff.php @@ -667,14 +667,14 @@ class Diff if($chunks) { foreach($chunks as $item) { // $tagStack > 0 indicates that we should be tag-building - if($tagStack[$listName]) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item; + if(isset($tagStack[$listName])) $rechunked[$listName][sizeof($rechunked[$listName])-1] .= ' ' . $item; else $rechunked[$listName][] = $item; - if($lookForTag && $item[0] == "<" && substr($item,0,2) != "" . htmlentities($item) . " -> " .$tagStack[$listName]; @@ -686,6 +686,7 @@ class Diff // Diff the re-chunked data, turning it into maked up HTML $diff = new Diff($rechunked[1], $rechunked[2]); + $content = ''; foreach($diff->edits as $edit) { // echo "
  • $edit->type: " . htmlentities(implode(" " ,$edit->orig)); // if($edit->final) echo ' / ' . htmlentities(implode(" " ,$edit->final)); @@ -716,7 +717,7 @@ class Diff $content = str_replace(array(" ","<", ">"),array(" "," <", "> "),$content); $candidateChunks = split("[\t\r\n ]+", $content); while(list($i,$item) = each($candidateChunks)) { - if($item[0] == "<") { + if(isset($item[0]) && $item[0] == "<") { $newChunk = $item; while($item[strlen($item)-1] != ">") { list($i,$item) = each($candidateChunks);