aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/sql_parse.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-01-28 00:57:27 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-01-28 00:57:27 +0000
commitebfc14b774378497c9aaaaf705c5af82b755c362 (patch)
tree12af5bb77c452337c9790d8c8b8b26ea07257d8e /phpBB/includes/sql_parse.php
parent1aad3f884a3d6f504a365ac71e6e75f93e44afcc (diff)
downloadforums-ebfc14b774378497c9aaaaf705c5af82b755c362.tar
forums-ebfc14b774378497c9aaaaf705c5af82b755c362.tar.gz
forums-ebfc14b774378497c9aaaaf705c5af82b755c362.tar.bz2
forums-ebfc14b774378497c9aaaaf705c5af82b755c362.tar.xz
forums-ebfc14b774378497c9aaaaf705c5af82b755c362.zip
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
Diffstat (limited to 'phpBB/includes/sql_parse.php')
-rw-r--r--phpBB/includes/sql_parse.php24
1 files changed, 13 insertions, 11 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]) )
+
+ if( !$in_comment )
{
- $in_comment = false;
- $i++;
+ $output .= $lines[$i] . "\n";
}
- if(!$in_comment)
+
+ if( preg_match("/\*\/$/", preg_quote($lines[$i])) )
{
- $output .= $lines[$i] . "\n";
+ $in_comment = false;
}
- $lines[$i] = '';
}
+
+ unset($lines);
return $output;
}
//