We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 92c3558 commit 15f8e0aCopy full SHA for 15f8e0a
src/Import.php
@@ -102,8 +102,13 @@ public function parse_statements( $sql_file_path ) {
102
for ( $i = 0; $i < $strlen; $i++ ) {
103
$ch = $line[ $i ];
104
105
- // Handle escaped characters
106
- if ( $i > 0 && '\\' === $line[ $i - 1 ] ) {
+ // Count preceding backslashes.
+ for ( $slashes = 0; '\\' === ( $line[ $slashes - $i - 1 ] ?? null ); $slashes += 1 );
107
+
108
+ // Handle escaped characters.
109
+ // A characters is escaped only when the number of preceding backslashes
110
+ // is odd - "\" is an escape sequence, "\\" is an escaped backslash.
111
+ if ( 1 === $slashes % 2 ) {
112
$buffer .= $ch;
113
continue;
114
}
0 commit comments