Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser doesnt work on windows #83

Open
ynizon opened this issue Feb 20, 2019 · 4 comments
Open

Parser doesnt work on windows #83

ynizon opened this issue Feb 20, 2019 · 4 comments
Labels

Comments

@ynizon
Copy link

ynizon commented Feb 20, 2019

Hi, thank you for your work. I have detect a bug on windows platform.
You can't detect new line in windows, because new line sometime is "\n" and sometime is "\r\n" and not only "\r" (like PHP_EOL).
I fix the newLine function to work on both systems. Can you add it to your release please ?
More docs here : https://stackoverflow.com/questions/21373478/n-vs-php-eol-vs-br

protected function newLine()
{
$r = in_array(
"\n", array(
$this->current_char,
$this->current_word
)
);
if (!$r){
$r = in_array(
PHP_EOL, array(
$this->current_char,
$this->current_word
)
);
}
return $r;

}
@genericAnomaly
Copy link

Can confirm I was going a bit mad trying to use the parser on a Windows build of Xampp, patched this in and it fixed everything. Merci beaucoup dude :)

@ynizon
Copy link
Author

ynizon commented May 9, 2019

Sorry, not working.Try my fix.

@ynizon
Copy link
Author

ynizon commented May 9, 2019

and add a namespace like this at the beginning (for use your lib with laravel):
namespace Tigor;

@t1gor
Copy link
Owner

t1gor commented Oct 19, 2021

Hey, guys. I've re-worked the parser a lot lately, but I guess new lines might still be an issue. Will take a look soon.

P.S. Namespaces are already there, but not released to packagist. You can take a look on master branch.

@JanPetterMG JanPetterMG added the bug label Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants