commit
de8368af45
|
@ -22,7 +22,7 @@ class JsonManipulator
|
|||
private static $DEFINES = '(?(DEFINE)
|
||||
(?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
|
||||
(?<boolean> true | false | null )
|
||||
(?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9a-f]{4} )* " )
|
||||
(?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
|
||||
(?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
|
||||
(?<pair> \s* (?&string) \s* : (?&json) \s* )
|
||||
(?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
|
||||
|
|
|
@ -2374,6 +2374,26 @@ class JsonManipulatorTest extends TestCase
|
|||
"package/a": "*"
|
||||
}
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
|
||||
public function testEscapedUnicodeDoesNotCauseBacktrackLimitErrorGithubIssue8131()
|
||||
{
|
||||
$manipulator = new JsonManipulator('{
|
||||
"description": "Some U\u00F1icode",
|
||||
"require": {
|
||||
"foo/bar": "^1.0"
|
||||
}
|
||||
}');
|
||||
|
||||
$this->assertTrue($manipulator->addLink('require', 'foo/baz', '^1.0'));
|
||||
$this->assertEquals('{
|
||||
"description": "Some U\u00F1icode",
|
||||
"require": {
|
||||
"foo/bar": "^1.0",
|
||||
"foo/baz": "^1.0"
|
||||
}
|
||||
}
|
||||
', $manipulator->getContents());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue