Don’t use strchr when scanning for newline after <<foo
The code that uses this is specifically for parsing <<foo inside a
quote-like operator inside a string eval.
This prints bar:
eval "s//<<foo/e
bar
foo
";
print $_ || $@;
This prints Can't find string terminator blah blah blah:
eval "s//<<foo/e #\0
bar
foo
";
print $_ || $@;
Nulls in comments are allowed elsewhere. This prints bar:
eval "\$_ = <<foo #\0
bar
foo
";
print $_ || $@;
The problem with strchr is that it is specifically for scanning null-
terminated strings. If embedded nulls are permitted (and should be in
this case), memchr should be used.
This code was added by
0244c3a403.