File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ private function readNumber(): string
143143 */
144144 private function readCommentString (): string
145145 {
146- for ($ data = '' ; ($ this ->getChar () ?? "\n" ) !== "\n" ; $ data .= $ this ->nextChar ());
146+ for ($ data = '' ; ($ char = $ this ->getChar () ?? "\n" ) !== "\n" && $ char !== "\r " ; $ data .= $ this ->nextChar ());
147147 return $ data ;
148148 }
149149
@@ -177,13 +177,13 @@ private function readQuotedString(): string
177177 for (; ($ char = $ this ->getChar () ?? '" ' ) !== '" ' ; $ data .= $ char ) {
178178 $ this ->nextChar ();
179179 if ($ char === '\\' ) {
180- if (($ alias = $ aliases [$ this ->nextChar ()] ?? null ) === null ) {
180+ // Ensures the next char is a valid escape character
181+ if (($ char = $ aliases [$ this ->nextChar ()] ?? null ) === null ) {
181182 throw new Exception ("Invalid quoted character at byte {$ this ->position }" );
182183 }
183- $ char = $ alias ;
184184 continue ;
185185 }
186- if ($ char === "\n" ) {
186+ if ($ char === "\n" || $ char === "\r" ) {
187187 throw new Exception ("New line character must be encoded at byte {$ this ->position }" );
188188 }
189189 }
You can’t perform that action at this time.
0 commit comments