wp/wp-includes/Text/Diff.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
--- a/wp/wp-includes/Text/Diff.php	Fri Sep 05 18:40:08 2025 +0200
+++ b/wp/wp-includes/Text/Diff.php	Fri Sep 05 18:52:52 2025 +0200
@@ -260,24 +260,24 @@
     function _check($from_lines, $to_lines)
     {
         if (serialize($from_lines) != serialize($this->getOriginal())) {
-            trigger_error("Reconstructed original does not match", E_USER_ERROR);
+            throw new Text_Exception("Reconstructed original does not match");
         }
         if (serialize($to_lines) != serialize($this->getFinal())) {
-            trigger_error("Reconstructed final does not match", E_USER_ERROR);
+            throw new Text_Exception("Reconstructed final does not match");
         }
 
         $rev = $this->reverse();
         if (serialize($to_lines) != serialize($rev->getOriginal())) {
-            trigger_error("Reversed original does not match", E_USER_ERROR);
+            throw new Text_Exception("Reversed original does not match");
         }
         if (serialize($from_lines) != serialize($rev->getFinal())) {
-            trigger_error("Reversed final does not match", E_USER_ERROR);
+            throw new Text_Exception("Reversed final does not match");
         }
 
         $prevtype = null;
         foreach ($this->_edits as $edit) {
-            if ($edit instanceof $prevtype) {
-                trigger_error("Edit sequence is non-optimal", E_USER_ERROR);
+            if ($prevtype !== null && $edit instanceof $prevtype) {
+                throw new Text_Exception("Edit sequence is non-optimal");
             }
             $prevtype = get_class($edit);
         }
@@ -350,15 +350,12 @@
  *
  * @access private
  */
-class Text_Diff_Op {
+abstract class Text_Diff_Op {
 
     var $orig;
     var $final;
 
-    function &reverse()
-    {
-        trigger_error('Abstract method', E_USER_ERROR);
-    }
+    abstract function &reverse();
 
     function norig()
     {