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

Windows problems #33

Closed
ghLoser opened this issue Aug 26, 2014 · 11 comments
Closed

Windows problems #33

ghLoser opened this issue Aug 26, 2014 · 11 comments

Comments

@ghLoser
Copy link
Contributor

ghLoser commented Aug 26, 2014

Extracting the header from files with windows line endings (CRLF) fails.
It would be great if the respective functions were less strict, e.g. by removing all CR characters before parsing.

@rhukster
Copy link
Member

Is there an exact error you are getting? Are there any special steps you did that we would need to follow t recreate? Thanks.

@ghLoser
Copy link
Contributor Author

ghLoser commented Aug 26, 2014

No error is thrown, but all header fields are ignored in a .md-file with CRLF line endings.
Easy to test with a template or title field, both will have no effect.

@rhukster
Copy link
Member

Could you please let me know what server setup you have? Is it a WAMP stack? Just would like to try to replicate as closely as possible. Cheers.

@ghLoser
Copy link
Contributor Author

ghLoser commented Aug 26, 2014

It's a WNMP stack with Nginx 1.7.4 and PHP 5.5.15 (Non Thread Safe + FastCGI)

https://github.com/wnmp/wnmp
http://www.getwnmp.org/

@rhukster
Copy link
Member

Well I think it's probably an Nginx issue. I just tried with EasyPHP and it works fine when I edit a file in Notepad++.

We did some preliminary testing with Nginx, hence the configuration file we've included with Grav. However, this is not thoroughly tested as we don't use it ourselves for development. Throw windows in to that mix too, and that's very uncharted territory for us.

Of course we want to ensure Grav runs on as many platforms and configurations as possible, so any help here identifying what is the cause and how to fix it would be helpful. Unfortunately we're all mac users, and windows is pretty foreign to us. Took me 30 mins to even get EasyPHP to run! Should be easy right? but i couldn't even find where the files were, and then i had to restart the VM to get it to run at all :(

@ghLoser
Copy link
Contributor Author

ghLoser commented Aug 26, 2014

No sweat, just wanted to let you know :)

@ghLoser ghLoser closed this as completed Aug 26, 2014
@mahagr
Copy link
Member

mahagr commented Aug 27, 2014

I'm going to reopen this one for now in case if someone else has some insights to the issue.

@mahagr mahagr reopened this Aug 27, 2014
@ghLoser
Copy link
Contributor Author

ghLoser commented Aug 27, 2014

Got it.
In Markdown.php, function decode(), line 109 all CRLFs and/or CRs are substituted with LFs, but in line 112 the original, unprocessed string is used.

So replacing
preg_match("/---\n(.+?)\n---(\n\n|$)/uism", $this->raw(), $m);
with
preg_match("/---\n(.+?)\n---(\n\n|$)/uism", $var, $m);
works for me.

Sorry, too dumb to make a pull request...

@rhukster
Copy link
Member

Ok great find! Pull requests are simple, just browse to the source of the page:

https://github.com/getgrav/grav/blob/develop/system/src/Grav/Common/Filesystem/File/Markdown.php

Click the edit icon and make your change, then comment and commit and a pull request is automatically made.

@ghLoser
Copy link
Contributor Author

ghLoser commented Aug 27, 2014

Thanks a lot, pull request created.

@rhukster
Copy link
Member

OK thanks, tested and works fine in our test setups. Merged 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants