mirror of
https://github.com/php/php-src.git
synced 2024-11-25 02:44:58 +08:00
Fixed bug #21297. The fix also fixes miscalculation of lines numbers by 1
due the previously mentioned bug.
This commit is contained in:
parent
ac3e8601ae
commit
5de9962d50
@ -1413,6 +1413,13 @@ consult the installation file that came with this distribution, or visit \n\
|
||||
while (c != 10 && c != 13) {
|
||||
c = fgetc(file_handle.handle.fp); /* skip to end of line */
|
||||
}
|
||||
/* handle situations where line is terminated by \r\n */
|
||||
if (c == 13) {
|
||||
if (fgetc(file_handle.handle.fp) != 10) {
|
||||
long pos = ftell(file_handle.handle.fp);
|
||||
fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
|
||||
}
|
||||
}
|
||||
CG(start_lineno) = 2;
|
||||
} else {
|
||||
rewind(file_handle.handle.fp);
|
||||
|
@ -695,6 +695,13 @@ int main(int argc, char *argv[])
|
||||
while (c != 10 && c != 13) {
|
||||
c = fgetc(file_handle.handle.fp); /* skip to end of line */
|
||||
}
|
||||
/* handle situations where line is terminated by \r\n */
|
||||
if (c == 13) {
|
||||
if (fgetc(file_handle.handle.fp) != 10) {
|
||||
long pos = ftell(file_handle.handle.fp);
|
||||
fseek(file_handle.handle.fp, pos - 1, SEEK_SET);
|
||||
}
|
||||
}
|
||||
CG(start_lineno) = 2;
|
||||
} else {
|
||||
rewind(file_handle.handle.fp);
|
||||
|
Loading…
Reference in New Issue
Block a user