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

No log files exist if the project path contains square brackets #115

Closed
EmadFathy opened this issue Sep 29, 2022 · 5 comments · Fixed by #122 or #123
Closed

No log files exist if the project path contains square brackets #115

EmadFathy opened this issue Sep 29, 2022 · 5 comments · Fixed by #122 or #123

Comments

@EmadFathy
Copy link

EmadFathy commented Sep 29, 2022

Hello,

The wrong behavior:

When opening the log-viewer no log files exist.

The cause:

Using PHP glob() function to get the log files breaks the package if the project path contains square brackets. This is a known issue with glob() function (https://bugs.php.net/bug.php?id=33047).

Example path:

D:\laravel\[2]New\

Glob() is used here:

$files = array_diff($files, glob($pattern));

If you can use another approach to get the log files, it will be great!

Specs:

PHP: 8.1.6
Laravel: 8.83.23
OS: Windows 10

@EmadFathy EmadFathy changed the title Using PHP glob() function breaks the package if the project path contains square brackets No log files exist if the project path contains square brackets Sep 29, 2022
@arukompas
Copy link
Contributor

Hey! Thanks for the report!

Because it's a Window's specific issue/bug, and it only happens to very specific use cases (the chances of someone using brackets in folder names is very low), I consider this to be a low priority.

Also, I just don't know a way of fixing this without introducing breaking changes (such as switching to Symfony's Finder component).

If anyone has a fix for this, please contribute! :)

Thanks 🙏

@EmadFathy
Copy link
Author

Hi @arukompas, thank you for the response.

At least you can check the path, and if it has the breaking symbols, show a user message telling the user that there is a problem with the path with the square bracket, maybe he is able to change it, but don't let him in the dark :).

@arukompas
Copy link
Contributor

Good thought. If the squares can be seen in the value of LogViewer::basePathForLogs() then we can issue a warning/error. Otherwise, when adding additional glob patters to match directories outside of your laravel project - we won't be able to tell what we missed because of the square brackets.

I'll have a look at it this Friday :) Good suggestion!

@arukompas
Copy link
Contributor

arukompas commented Oct 4, 2022

Hey @EmadFathy - the newest release v1.5.2 should have a potential fix for the square brackets in Windows paths.

Let me know if it works or not! 😄

@EmadFathy
Copy link
Author

Hi @arukompas ,

Thank you for your concern. I confirm version 1.5.3 (tested on Laravel 8.83.25 on Windows 10) is working perfectly with path including square brackets, and now the log files appears. thank you again.

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