Closed joostdekeijzer closed 6 years ago
Hello! You are right.
Do you expect me to release it on WP.org?
@joostdekeijzer Actually we have more of those EOL-s. https://github.com/szepeviktor/multipart-robotstxt-editor/blob/master/mp-robotstxt.php#L284-L308
Ah, yes. I think the other EOL-s are not breaking...
The preg \R
placeholder is really nice in this context (eg. preg_replace( '/\R/', "\n", $content)
). It represents all newline possiblities. See http://php.net/manual/en/regexp.reference.escape.php.
My site is currently fixed, so no urgent need to release on WP.org, thanks!
OK, I've moved to static robots.txt-s.
The parser uses
PHP_EOL
als a line delimiter, which on Windows is "\r\n" (two characters!).The
newLine()
method tests for a newline on either the current char (one character so the "\r" on Windows) or on the current word. Since the current word contains all text before the newline (eg. "*\r\n") it is never triggered, resulting in an empty rules array.This change forces the use of "\n" as a newline character in stead of PHP_EOL.