From ebfc14b774378497c9aaaaf705c5af82b755c362 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Mon, 28 Jan 2002 00:57:27 +0000 Subject: [PATCH] preg_quote lines for /* comment parsed SQL ... was causing failure on install for mssql ... git-svn-id: file:///svn/phpbb/trunk@1977 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/sql_parse.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/sql_parse.php b/phpBB/includes/sql_parse.php index d57b44eb9c..c2bb4db4c6 100644 --- a/phpBB/includes/sql_parse.php +++ b/phpBB/includes/sql_parse.php @@ -32,32 +32,34 @@ // remove_comments will strip the sql comment lines out of an uploaded sql file // specifically for mssql and postgres type files in the install.... // -function remove_comments($sql) +function remove_comments(&$output) { - $lines = explode("\n", $sql); + $lines = explode("\n", $output); + $output = ""; // try to keep mem. use down - $sql = ""; $linecount = count($lines); - $output = ""; + $in_comment = false; for($i = 0; $i < $linecount; $i++) { - if( ereg("^\/\*", $lines[$i]) ) + if( preg_match("/^\/\*/", preg_quote($lines[$i])) ) { $in_comment = true; } - if( ereg("\*\/$", $lines[$i]) ) - { - $in_comment = false; - $i++; - } - if(!$in_comment) + + if( !$in_comment ) { $output .= $lines[$i] . "\n"; } - $lines[$i] = ''; + + if( preg_match("/\*\/$/", preg_quote($lines[$i])) ) + { + $in_comment = false; + } } + + unset($lines); return $output; } //