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

LLMS_Block_Templates::generate_template_slug_from_path() directory separator #2001

Closed
1 of 4 tasks
pondermatic opened this issue Feb 16, 2022 · 2 comments · Fixed by #2000
Closed
1 of 4 tasks

LLMS_Block_Templates::generate_template_slug_from_path() directory separator #2001

pondermatic opened this issue Feb 16, 2022 · 2 comments · Fixed by #2000
Assignees
Labels
Status: Has PR This issue has an open pull request Type: Bug Bugs and errors

Comments

@pondermatic
Copy link
Contributor

Reproduction Steps

$block_templates = new LLMS_Block_Templates();
$windows_path = 'C:\WordPress\src\wp-content\plugins\lifterlms/templates/block-templates/template.html';
$template_slug = $block_templates( $windows_path );

Expected Behavior

'llms_template' === $template_slug

Actual Behavior

'llms_dPress\src\wp-content\plugins\lifterlms/templates/block-templates/template' === $template_slug

Cause

The path is built here with '/' between the templates and block-templates directories. However, this line uses DIRECTORY_SEPARATOR instead of '/'.

System and Environment Information

Windows 10
PHP 7.4

This issue has be recreated:

  • Locally
  • On a staging site
  • On a production website
  • With only LifterLMS and a default theme
@eri-trabiccolo
Copy link
Collaborator

@pondermatic will replacing:
strpos( $path, $dirname . DIRECTORY_SEPARATOR ) + 1 + strlen( $dirname ),
with:
strpos( $path, $dirname . '/' ) + 1 + strlen( $dirname ),

fix the issue on Windows?

@pondermatic
Copy link
Contributor Author

Yes, that will fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Has PR This issue has an open pull request Type: Bug Bugs and errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants