bug79934.phpt 968 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. Bug #79934: CRLF-only line in heredoc causes parsing error
  3. --DESCRIPTION--
  4. This test covers different variations of whitespace-only lines in heredoc strings.
  5. These whitespace-only lines should be ignored when stripping indentation.
  6. --FILE--
  7. <?php
  8. // lines with only CRLF should not cause a parse error
  9. eval("\$s1 = <<<HEREDOC\r\n a\r\n\r\n b\r\n HEREDOC;");
  10. var_dump(addcslashes($s1, "\r\n"));
  11. // lines with only a LF should not cause a parse error
  12. eval("\$s2 = <<<HEREDOC\n a\n\n b\n HEREDOC;");
  13. var_dump(addcslashes($s2, "\n"));
  14. // lines with only a CR should not cause a parse error
  15. eval("\$s3 = <<<HEREDOC\r a\r\r b\r HEREDOC;");
  16. var_dump(addcslashes($s3, "\r"));
  17. // lines with only whitespace should not cause a parse error
  18. eval("\$s4 = <<<HEREDOC\r a\r\n \r\n b\r HEREDOC;");
  19. var_dump(addcslashes($s4, "\n\r"));
  20. ?>
  21. --EXPECT--
  22. string(10) "a\r\n\r\nb"
  23. string(6) "a\n\nb"
  24. string(6) "a\r\rb"
  25. string(10) "a\r\n\r\nb"