[2.0.0] Assets filter issue
I have some issue with assets- when i try to filter them and join- and specify which resource is non local and non be filtered- then server crash. This issue occur and with JS files.
$this->assets->collection('css')
->addCss('http://someurl.com/css/libs/normalize.css', false, false)
->addCss('http://someurl.com/css/libs/basic.css', false, false)
->addCss("css/default.css");
->setTargetPath('css/compile.css')
->setTargetUri('css/compile.css')
->join(true)
->addFilter(new \Phalcon\Assets\Filters\Cssmin());
Thank you for Phalcon - amazing framework! PS: sorry for my english
Is just this the code to reproduce the issue?
<?php
$assets = new Phalcon\Assets\Manager;
$assets->collection('css')
->addCss('http://someurl.com/css/libs/normalize.css', false, false)
->addCss('http://someurl.com/css/libs/basic.css', false, false)
->addCss("css/default.css")
->setTargetPath('css/compile.css')
->setTargetUri('css/compile.css')
->join(true)
->addFilter(new \Phalcon\Assets\Filters\Cssmin());
I've tested it and seems to work.
Hi there, It was in controller (MVC, multi module), so... i copy/paste your code and yes- same issue - crash without error- i think is something like a loop or try to make connection (to join) but didnt make it. I didnt mention that server is my local pc- XAMPP- with last DLL (32 bit / PHP 5.6.0 (VC11)) from April 08 2015.
I test all url-s and they work. Its happened when i include external resources :/ I will continue to test and try to figure out what is the issue.
So... thank you... let the force be with u... always :)
I have some details here... after review my apache logs i found some errors, fix them by removing extension php_xdebug (do some restart stuff "AH00428: Parent: child process 3496 exited with status 255 -- Restarting."- no idea)... and the error occur in browser:
Resource 'http://someurl.com/css/libs/normalize.css' have the same source and target paths
...So... i google it and found that this is some issue... and it was found on all Phalcon dll version before 1.3.4.
Is there solution for that?
@andresgutierrez You need to call outputCss at the end to see the exception.
@butamuh4o There's a bug... but from http://docs.phalconphp.com/en/latest/reference/assets.html:
Some resources may be remote, that is, they’re obtained by HTTP from a remote source for further filtering. It is recommended to convert the external resources to local eliminating the overhead of obtaining them.
@butamuh4o Oups... I didn't see the "false" after each URL... Forget my comment.
From 1.3.4 (https://github.com/phalcon/cphalcon/blob/master/ext/assets/manager.c#L727):
if (zend_is_true(local)) {
From 2.0.0 (https://github.com/phalcon/cphalcon/blob/2.0.0/phalcon/assets/manager.zep#L475):
if join {
Please check with latest 2.0.0.
Thanks, mate :) i will check and will notify what ive did xD ...this is with latest 2.0.0 version (from April 08 / dll ) :/ I will check when new 2.0.0 will be released.
Hi again :) after update- all works now. FIlter is working properly.
But we have new issue!
If u see same example up... ive try to combine all local css but didnt want to include external files... If i mark some resource to be not included in compiled file (not filtered) - third parameter in addCSS (see docuemnation)- Phalcon compile them all- and that is the issue: didnt use the settings i give.
So- old problem is solved, new appear :/ I hope you understand me. My english is not so good.