Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F73137
D7323.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D7323.diff
View Options
diff --git a/src/lexer/PhutilLexer.php b/src/lexer/PhutilLexer.php
--- a/src/lexer/PhutilLexer.php
+++ b/src/lexer/PhutilLexer.php
@@ -226,6 +226,7 @@
while ($position < $length) {
$state_rules = idx($rules, end($states), array());
foreach ($state_rules as $rule) {
+
$matches = null;
if (!preg_match($rule[0], $input, $matches, 0, $position)) {
continue;
diff --git a/src/lexer/PhutilSimpleOptionsLexer.php b/src/lexer/PhutilSimpleOptionsLexer.php
--- a/src/lexer/PhutilSimpleOptionsLexer.php
+++ b/src/lexer/PhutilSimpleOptionsLexer.php
@@ -78,11 +78,13 @@
array('[^\'\\\\]+', 'word'),
array("'", "'", '!pop'),
array('\\\\.', 'esc'),
+ array('\\\\$', '!pop'),
),
'string2' => array(
array('[^"\\\\]+', 'word'),
array('"', '"', '!pop'),
array('\\\\.', 'esc'),
+ array('\\\\$', '!pop'),
),
);
}
diff --git a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
--- a/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
+++ b/src/parser/__tests__/PhutilSimpleOptionsTestCase.php
@@ -80,6 +80,25 @@
}
}
+ public function testSimpleOptionsUnterminatedStrings() {
+ $list = array(
+ '"',
+ "'",
+ 'a="',
+ "a='",
+ 'a="\\',
+ "a='\\",
+ );
+
+ foreach ($list as $input) {
+ $parser = new PhutilSimpleOptions();
+ $this->assertEqual(
+ array(),
+ $parser->parse($input),
+ "Correct failing parse of invalid input: {$input}");
+ }
+ }
+
public function testSimpleOptionsUnparse() {
$map = array(
'' => array(),
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/uf/uf/z3eebgtkcmycjzdq
Default Alt Text
D7323.diff (1 KB)
Attached To
Mode
D7323: Fix a lexer issue with SimpleOptions and backslashes in unterminated quotes
Attached
Detach File
Event Timeline
Log In to Comment