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

$theme->asset->get_file() create wrong url on windows #2009

Open
scruwi opened this issue Jul 26, 2016 · 3 comments
Open

$theme->asset->get_file() create wrong url on windows #2009

scruwi opened this issue Jul 26, 2016 · 3 comments

Comments

@scruwi
Copy link

scruwi commented Jul 26, 2016

<?php echo  \Theme::forge()->asset->get_file('image.png', 'img'); ?>

expected

http://site/theme/default/img/image.png

get

http://site/theme/D:/xampp/site/public/theme/default/img/image.png

because

File: /fuel/core/classes/asset/instance.php
Function: find_file()
Line: 316
return str_replace(DS, '/', $newfile);

Function: get_file()
Line: 339
strpos($file, DOCROOT) = null instead strpos($file, DOCROOT) = 0

@WanWizard
Copy link
Member

WanWizard commented Jul 27, 2016

I don't have Windows here to test it.

Could you change line 315 to:

return realpath($newfile);

and see if that solves your problem?

@scruwi
Copy link
Author

scruwi commented Jul 27, 2016

It solve my problem, but make another:

<?php echo  \Theme::forge()->asset->css('bootstrap.min.css'); ?>

get

http://site/D:/xampp/htdocs/site/public/plugins/bootstrap-3.3.6-dist/css/bootstrap.min.css?1468713961

this problem occurs with absolute _asset_paths in $theme->asset instance.

$theme = Theme::forge();
$theme->asset->add_path('plugins/bootstrap-3.3.6-dist');
var_dump($theme->asset)
//  ...
//  protected '_asset_paths' => 
//    array (size=3)
//      'css' => 
//        array (size=2)
//          0 => string 'D:\xampp\htdocs\site\public\theme\default\css\' (length=61)
//          1 => string 'plugins\bootstrap-3.3.6-dist\css\' (length=33)
//  ...

Is it possible to make relative _asset_paths by default? In this case, my problem will be solved.

@WanWizard
Copy link
Member

Forget that fix, that will have issues on Linux too. For the same reason your solution can't be applied.

I need to setup a WAMP environment to properly test it.

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

2 participants