From 4a067e8949c7ea217c1a20c6dcf2ea05308d26b1 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 25 May 2013 21:38:25 +0000 Subject: [PATCH] Remove deprecated pass-by-reference from the Text_Diff external library. Upstream is not back compat. see #24372. git-svn-id: http://core.svn.wordpress.org/trunk@24362 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/Text/Diff.php | 8 ++++---- wp-includes/Text/Diff/Engine/native.php | 8 ++++---- wp-includes/Text/Diff/Engine/string.php | 20 ++++++++++---------- wp-includes/Text/Diff/Engine/xdiff.php | 6 +++--- wp-includes/Text/Diff/Renderer.php | 4 ++-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/wp-includes/Text/Diff.php b/wp-includes/Text/Diff.php index 3ba7b4c7ea..b7eae7daba 100644 --- a/wp-includes/Text/Diff.php +++ b/wp-includes/Text/Diff.php @@ -377,7 +377,7 @@ class Text_Diff_Op_copy extends Text_Diff_Op { function &reverse() { - $reverse = &new Text_Diff_Op_copy($this->final, $this->orig); + $reverse = new Text_Diff_Op_copy($this->final, $this->orig); return $reverse; } @@ -399,7 +399,7 @@ class Text_Diff_Op_delete extends Text_Diff_Op { function &reverse() { - $reverse = &new Text_Diff_Op_add($this->orig); + $reverse = new Text_Diff_Op_add($this->orig); return $reverse; } @@ -421,7 +421,7 @@ class Text_Diff_Op_add extends Text_Diff_Op { function &reverse() { - $reverse = &new Text_Diff_Op_delete($this->final); + $reverse = new Text_Diff_Op_delete($this->final); return $reverse; } @@ -443,7 +443,7 @@ class Text_Diff_Op_change extends Text_Diff_Op { function &reverse() { - $reverse = &new Text_Diff_Op_change($this->final, $this->orig); + $reverse = new Text_Diff_Op_change($this->final, $this->orig); return $reverse; } diff --git a/wp-includes/Text/Diff/Engine/native.php b/wp-includes/Text/Diff/Engine/native.php index 93eaef220d..e908cfecca 100644 --- a/wp-includes/Text/Diff/Engine/native.php +++ b/wp-includes/Text/Diff/Engine/native.php @@ -104,7 +104,7 @@ class Text_Diff_Engine_native { ++$yi; } if ($copy) { - $edits[] = &new Text_Diff_Op_copy($copy); + $edits[] = new Text_Diff_Op_copy($copy); } // Find deletes & adds. @@ -119,11 +119,11 @@ class Text_Diff_Engine_native { } if ($delete && $add) { - $edits[] = &new Text_Diff_Op_change($delete, $add); + $edits[] = new Text_Diff_Op_change($delete, $add); } elseif ($delete) { - $edits[] = &new Text_Diff_Op_delete($delete); + $edits[] = new Text_Diff_Op_delete($delete); } elseif ($add) { - $edits[] = &new Text_Diff_Op_add($add); + $edits[] = new Text_Diff_Op_add($add); } } diff --git a/wp-includes/Text/Diff/Engine/string.php b/wp-includes/Text/Diff/Engine/string.php index 59eb8adb45..0f3b3745a5 100644 --- a/wp-includes/Text/Diff/Engine/string.php +++ b/wp-includes/Text/Diff/Engine/string.php @@ -99,7 +99,7 @@ class Text_Diff_Engine_string { do { $diff1[] = substr($diff[$i], 1); } while (++$i < $end && substr($diff[$i], 0, 1) == ' '); - $edits[] = &new Text_Diff_Op_copy($diff1); + $edits[] = new Text_Diff_Op_copy($diff1); break; case '+': @@ -107,7 +107,7 @@ class Text_Diff_Engine_string { do { $diff1[] = substr($diff[$i], 1); } while (++$i < $end && substr($diff[$i], 0, 1) == '+'); - $edits[] = &new Text_Diff_Op_add($diff1); + $edits[] = new Text_Diff_Op_add($diff1); break; case '-': @@ -121,9 +121,9 @@ class Text_Diff_Engine_string { $diff2[] = substr($diff[$i++], 1); } if (count($diff2) == 0) { - $edits[] = &new Text_Diff_Op_delete($diff1); + $edits[] = new Text_Diff_Op_delete($diff1); } else { - $edits[] = &new Text_Diff_Op_change($diff1, $diff2); + $edits[] = new Text_Diff_Op_change($diff1, $diff2); } break; @@ -189,7 +189,7 @@ class Text_Diff_Engine_string { $array[] = substr($diff[$j++], 2); } if (count($array) > 0) { - $edits[] = &new Text_Diff_Op_copy($array); + $edits[] = new Text_Diff_Op_copy($array); } if ($i < $max_i) { @@ -203,21 +203,21 @@ class Text_Diff_Engine_string { $diff2[] = substr($diff[$j++], 2); } } while (++$i < $max_i && substr($diff[$i], 0, 1) == '!'); - $edits[] = &new Text_Diff_Op_change($diff1, $diff2); + $edits[] = new Text_Diff_Op_change($diff1, $diff2); break; case '+': do { $diff1[] = substr($diff[$i], 2); } while (++$i < $max_i && substr($diff[$i], 0, 1) == '+'); - $edits[] = &new Text_Diff_Op_add($diff1); + $edits[] = new Text_Diff_Op_add($diff1); break; case '-': do { $diff1[] = substr($diff[$i], 2); } while (++$i < $max_i && substr($diff[$i], 0, 1) == '-'); - $edits[] = &new Text_Diff_Op_delete($diff1); + $edits[] = new Text_Diff_Op_delete($diff1); break; } } @@ -229,14 +229,14 @@ class Text_Diff_Engine_string { do { $diff2[] = substr($diff[$j++], 2); } while ($j < $max_j && substr($diff[$j], 0, 1) == '+'); - $edits[] = &new Text_Diff_Op_add($diff2); + $edits[] = new Text_Diff_Op_add($diff2); break; case '-': do { $diff2[] = substr($diff[$j++], 2); } while ($j < $max_j && substr($diff[$j], 0, 1) == '-'); - $edits[] = &new Text_Diff_Op_delete($diff2); + $edits[] = new Text_Diff_Op_delete($diff2); break; } } diff --git a/wp-includes/Text/Diff/Engine/xdiff.php b/wp-includes/Text/Diff/Engine/xdiff.php index b9f1736045..02ce848078 100644 --- a/wp-includes/Text/Diff/Engine/xdiff.php +++ b/wp-includes/Text/Diff/Engine/xdiff.php @@ -45,15 +45,15 @@ class Text_Diff_Engine_xdiff { } switch ($line[0]) { case ' ': - $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); + $edits[] = new Text_Diff_Op_copy(array(substr($line, 1))); break; case '+': - $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); + $edits[] = new Text_Diff_Op_add(array(substr($line, 1))); break; case '-': - $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); + $edits[] = new Text_Diff_Op_delete(array(substr($line, 1))); break; } } diff --git a/wp-includes/Text/Diff/Renderer.php b/wp-includes/Text/Diff/Renderer.php index 922f4c09cc..95c6db4b89 100644 --- a/wp-includes/Text/Diff/Renderer.php +++ b/wp-includes/Text/Diff/Renderer.php @@ -98,7 +98,7 @@ class Text_Diff_Renderer { /* Create a new block with as many lines as we need * for the trailing context. */ $context = array_slice($edit->orig, 0, $ntrail); - $block[] = &new Text_Diff_Op_copy($context); + $block[] = new Text_Diff_Op_copy($context); } /* @todo */ $output .= $this->_block($x0, $ntrail + $xi - $x0, @@ -118,7 +118,7 @@ class Text_Diff_Renderer { $y0 = $yi - count($context); $block = array(); if ($context) { - $block[] = &new Text_Diff_Op_copy($context); + $block[] = new Text_Diff_Op_copy($context); } } $block[] = $edit;