From dae2cd608e9a0a52a7ec12d3d535ccb9000d0bcb Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 28 May 2014 12:32:15 -0500
Subject: [PATCH] rfc822: Fix validation bug introduced in f99ca0c4

Also add several lint fixes for packaging
---
 include/pear/Mail/RFC822.php | 6 ++----
 setup/cli/modules/import.php | 2 +-
 setup/test/tests/stubs.php   | 2 ++
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/pear/Mail/RFC822.php b/include/pear/Mail/RFC822.php
index f22e4ecfe..abf1000d9 100644
--- a/include/pear/Mail/RFC822.php
+++ b/include/pear/Mail/RFC822.php
@@ -363,13 +363,11 @@ class Mail_RFC822 {
     function _hasUnclosedQuotes($string)
     {
         $matches = array();
-        if (!preg_match_all('/\\|"/S', $string, $matches, PREG_SET_ORDER))
+        if (!preg_match_all('/[\\"]/', trim($string), $matches))
             return false;
 
-        $string = trim($string);
-        $iMax = strlen($string);
         $in_quote = false;
-        $i = $slashes = 0;
+        $slashes = 0;
 
         foreach ($matches[0] as $m) {
             switch ($m) {
diff --git a/setup/cli/modules/import.php b/setup/cli/modules/import.php
index 68979f330..27bf8962e 100644
--- a/setup/cli/modules/import.php
+++ b/setup/cli/modules/import.php
@@ -266,7 +266,7 @@ class Importer_B extends Importer {
         $this->stderr->write("Importing table: {$header[1]}\n");
 
         $res = db_query("select column_name from information_schema.columns
-            where table_schema=DATABASE() and table_name='$t'");
+            where table_schema=DATABASE() and table_name='{$header[1]}'");
         while (list($field) = db_fetch_row($res))
             if (!in_array($field, $header[2]))
                 $this->fail($header[1]
diff --git a/setup/test/tests/stubs.php b/setup/test/tests/stubs.php
index 1a40562c4..326a7dbf0 100644
--- a/setup/test/tests/stubs.php
+++ b/setup/test/tests/stubs.php
@@ -92,6 +92,8 @@ class Phar {
 class ZipArchive {
     function statIndex() {}
     function getFromIndex() {}
+    function setCommentName() {}
+    function addFromString() {}
 }
 
 class finfo {
-- 
GitLab