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

Assets not found on Windows with Zikula in a subdirectory #4480

Closed
Fraddy opened this issue Sep 17, 2020 · 2 comments · Fixed by #4482
Closed

Assets not found on Windows with Zikula in a subdirectory #4480

Fraddy opened this issue Sep 17, 2020 · 2 comments · Fixed by #4482
Labels
Milestone

Comments

@Fraddy
Copy link

Fraddy commented Sep 17, 2020

Q A
Zikula Version 3.0.3
PHP Version 7.4.10

Expected Behavior: the same as on Linux

Current Behavior

Apologies!
Error Code: -1
Could not find asset "C:\PUBLIC_DIR/PUBLIC_PATH"

(please notice the backward and forward slashes)

Possible Solution

Update: vendor\zikula\theme-module\Engine\Asset.php
Line 87: $publicDir = $this->kernel->getProjectDir() . '/public';
Replace with: $publicDir = str_replace('\\', '/', $this->kernel->getProjectDir()) . '/public';

$this->kernel->getProjectDir() returns basically __DIR__ and contains backslashes on Windows.

This causes line 89 to fail on the replacement as $basePath contains forward slashes:
$httpRootDir = str_replace($basePath, '', $publicDir);

Context

This issue will only occur on Windows webservers when Zikula is not installed in the document root but in a subdirectory.

@Fraddy Fraddy added the Bug label Sep 17, 2020
@Guite Guite added this to the 3.0.4 milestone Sep 17, 2020
@Guite
Copy link
Member

Guite commented Sep 17, 2020

Thank you very much for reporting 👍
We are going to include this into the next update.

Guite added a commit that referenced this issue Sep 19, 2020
* fix replacement issue on Windows (#4480)

* add changelog entry
@Guite
Copy link
Member

Guite commented Sep 19, 2020

Fixed in #4482

@Guite Guite closed this as completed Sep 19, 2020
@Guite Guite modified the milestones: 3.0.4, 3.1.0 Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants