Closed kylekatarnls closed 9 years ago
Thanks for the bug report. What is output when you type php composer.phar update
in piwik root?
A priori, everything's good:
D:\PHP\piwik\piwik>composer update Loading composer repositories with package information Updating dependencies (including require-dev) Nothing to install or update Generating autoload files
I did a 'git fetch upstream' and merge to update my fork then 'composer update' and there is always a problem with less and background image but not the same:
An exception has been thrown during the rendering of a template ("parse error: failed at background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAA3NCSVQICAjb4U/gAAAAOVBMVEX///8AAAAAAABXV1dSUlKsrKzExMTd3d3V1dXp6end3d3p6enz8/P7+/v39/f///+vqZ6oopWUjH2LPulWAAAAE3RSTlMAESIzM2Z3mZmqqrvd7u7/////UUgTXgAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAYdEVYdENyZWF0aW9uIFRpbWUAMDMuMDEuMjAxM8rVeD8AAABnSURBVBiVhY/LFoAgCEQZ0p4W6f9/bIJ4slV3oTIeBoaICGADIAO8ibEwWn2IcwVovev7znqmCYRon9kEWUFvg3IysXyIXSil3fOvELupC9XUx7pQx/piDV1sVFLwMNF80sw97hj/AXRPCjtYdmhtAAAAAElFTkSuQmCC); line: 4004") in "@CoreUpdater/runUpdaterAndExit_welcome.twig" at line 5.
Barbaric solution: Comment exceptions in lessc.inc.php (line 2272)
//if ($this->count != strlen($this->buffer)) //$this->throwError(); // TODO report where the block was opened //if (!is_null($this->env->parent)) //throw new exception('parse error: unclosed block');
Maybe its related: https://github.com/piwik/piwik/blob/master/misc/composer/clean-xhprof.sh fail when composer update: misc is not recognized (I'm on Windows), so I did composer update --no-scripts.
Hi @kylekatarnls, can you update your piwik repo, turn on debug file logging and trigger the bug? If you see an exception in the log file in tmp/logs/piwik.log it might help diagnose this problem. Also can you tell me what version of php-less you're using?
php-less is 0.3-dev
The error in the log file:
DEBUG CoreHome[2014-09-07 10:10:56] D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(3553): parse error: failed at `background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAA3NCSVQICAjb4U/gAAAAOVBMVEX///8AAAAAAABXV1dSUlKsrKzExMTd3d3V1dXp6end3d3p6enz8/P7+/v39/f///+vqZ6oopWUjH2LPulWAAAAE3RSTlMAESIzM2Z3mZmqqrvd7u7/////UUgTXgAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNXG14zYAAAAYdEVYdENyZWF0aW9uIFRpbWUAMDMuMDEuMjAxM8rVeD8AAABnSURBVBiVhY/LFoAgCEQZ0p4W6f9/bIJ4slV3oTIeBoaICGADIAO8ibEwWn2IcwVovev7znqmCYRon9kEWUFvg3IysXyIXSil3fOvELupC9XUx7pQx/piDV1sVFLwMNF80sw97hj/AXRPCjtYdmhtAAAAAElFTkSuQmCC); ` line: 4004 #0 D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(2364): lessc_parser->throwError() #1 D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(1887): lessc_parser->parse('/*! jQuery UI -...') #2 D:\PHP\piwik\piwik\core\AssetManager\UIAssetMerger\StylesheetUIAssetMerger.php(36): lessc->compile('/*! jQuery UI -...') #3 D:\PHP\piwik\piwik\core\AssetManager\UIAssetMerger.php(54): Piwik\AssetManager\UIAssetMerger\StylesheetUIAssetMerger->getMergedAssets() #4 D:\PHP\piwik\piwik\core\AssetManager.php(169): Piwik\AssetManager\UIAssetMerger->generateFile() #5 D:\PHP\piwik\piwik\core\View.php(283): Piwik\AssetManager->getMergedStylesheet() #6 D:\PHP\piwik\piwik\core\View.php(268): Piwik\View->applyFilter_cacheBuster('<div class="seg...') #7 D:\PHP\piwik\piwik\core\View.php(253): Piwik\View->renderTwigTemplate() #8 D:\PHP\piwik\piwik\core\View\UIControl.php(116): Piwik\View->render() #9 D:\PHP\piwik\piwik\plugins\SegmentEditor\SegmentEditor.php(50): Piwik\View\UIControl->render() #10 [internal function]: Piwik\Plugins\SegmentEditor\SegmentEditor->getSegmentEditorHtml('') #11 D:\PHP\piwik\piwik\core\EventDispatcher.php(116): call_user_func_array(Array, Array) #12 D:\PHP\piwik\piwik\core\Piwik.php(784): Piwik\EventDispatcher->postEvent('Template.nextTo...', Array, false, NULL) #13 D:\PHP\piwik\piwik\core\Twig.php(148): Piwik\Piwik::postEvent('Template.nextTo...', Array) #14 [internal function]: Piwik\Twig->Piwik\{closure}('Template.nextTo...') #15 D:\PHP\piwik\piwik\tmp\templates_c\85\89\9434c8f5ac3aa7eaca66492d25c7c93762acab92a6aec31855bccc9cea65.php(32): call_user_func_array(Object(Closure), Array) #16 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_85899434c8f5ac3aa7eaca66492d25c7c93762acab92a6aec31855bccc9cea65->doDisplay(Array, Array) #17 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #18 D:\PHP\piwik\piwik\tmp\templates_c\a0\de\ad2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5.php(54): Twig_Template->display(Array) #19 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(144): __TwigTemplate_a0dead2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5->block_content(Array, Array) #20 D:\PHP\piwik\piwik\tmp\templates_c\37\cf\dc757c134ca31e3272b75d39bfc22c90c332eb56e6156b93651f8f212454.php(73): Twig_Template->displayBlock('content', Array, Array) #21 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_37cfdc757c134ca31e3272b75d39bfc22c90c332eb56e6156b93651f8f212454->doDisplay(Array, Array) #22 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #23 D:\PHP\piwik\piwik\tmp\templates_c\a0\de\ad2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5.php(25): Twig_Template->display(Array, Array) #24 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_a0dead2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5->doDisplay(Array, Array) #25 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #26 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(264): Twig_Template->display(Array) #27 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Environment.php(292): Twig_Template->render(Array) #28 D:\PHP\piwik\piwik\core\View.php(259): Twig_Environment->render('@CoreHome/getDe...', Array) #29 D:\PHP\piwik\piwik\core\View.php(253): Piwik\View->renderTwigTemplate() #30 D:\PHP\piwik\piwik\plugins\CoreHome\Controller.php(169): Piwik\View->render() #31 [internal function]: Piwik\Plugins\CoreHome\Controller->index() #32 D:\PHP\piwik\piwik\core\FrontController.php(577): call_user_func_array(Array, Array) #33 D:\PHP\piwik\piwik\core\FrontController.php(86): Piwik\FrontController->doDispatch(NULL, NULL, NULL) #34 D:\PHP\piwik\piwik\core\dispatch.php(34): Piwik\FrontController->dispatch() #35 D:\PHP\piwik\piwik\index.php(46): require_once('D:\PHP\piwik\pi...') #36 {main}
And when I comment the backgorund-image lines in the less files, I get:
DEBUG CoreHome[2014-09-07 10:08:37] D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(3555): parse error: line: 5732 #0 D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(2364): lessc_parser->throwError() #1 D:\PHP\piwik\piwik\vendor\leafo\lessphp\lessc.inc.php(1887): lessc_parser->parse('/*! jQuery UI -...') #2 D:\PHP\piwik\piwik\core\AssetManager\UIAssetMerger\StylesheetUIAssetMerger.php(36): lessc->compile('/*! jQuery UI -...') #3 D:\PHP\piwik\piwik\core\AssetManager\UIAssetMerger.php(54): Piwik\AssetManager\UIAssetMerger\StylesheetUIAssetMerger->getMergedAssets() #4 D:\PHP\piwik\piwik\core\AssetManager.php(169): Piwik\AssetManager\UIAssetMerger->generateFile() #5 D:\PHP\piwik\piwik\core\View.php(283): Piwik\AssetManager->getMergedStylesheet() #6 D:\PHP\piwik\piwik\core\View.php(268): Piwik\View->applyFilter_cacheBuster('<div class="seg...') #7 D:\PHP\piwik\piwik\core\View.php(253): Piwik\View->renderTwigTemplate() #8 D:\PHP\piwik\piwik\core\View\UIControl.php(116): Piwik\View->render() #9 D:\PHP\piwik\piwik\plugins\SegmentEditor\SegmentEditor.php(50): Piwik\View\UIControl->render() #10 [internal function]: Piwik\Plugins\SegmentEditor\SegmentEditor->getSegmentEditorHtml('') #11 D:\PHP\piwik\piwik\core\EventDispatcher.php(116): call_user_func_array(Array, Array) #12 D:\PHP\piwik\piwik\core\Piwik.php(784): Piwik\EventDispatcher->postEvent('Template.nextTo...', Array, false, NULL) #13 D:\PHP\piwik\piwik\core\Twig.php(148): Piwik\Piwik::postEvent('Template.nextTo...', Array) #14 [internal function]: Piwik\Twig->Piwik\{closure}('Template.nextTo...') #15 D:\PHP\piwik\piwik\tmp\templates_c\85\89\9434c8f5ac3aa7eaca66492d25c7c93762acab92a6aec31855bccc9cea65.php(32): call_user_func_array(Object(Closure), Array) #16 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_85899434c8f5ac3aa7eaca66492d25c7c93762acab92a6aec31855bccc9cea65->doDisplay(Array, Array) #17 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #18 D:\PHP\piwik\piwik\tmp\templates_c\a0\de\ad2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5.php(54): Twig_Template->display(Array) #19 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(144): __TwigTemplate_a0dead2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5->block_content(Array, Array) #20 D:\PHP\piwik\piwik\tmp\templates_c\37\cf\dc757c134ca31e3272b75d39bfc22c90c332eb56e6156b93651f8f212454.php(73): Twig_Template->displayBlock('content', Array, Array) #21 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_37cfdc757c134ca31e3272b75d39bfc22c90c332eb56e6156b93651f8f212454->doDisplay(Array, Array) #22 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #23 D:\PHP\piwik\piwik\tmp\templates_c\a0\de\ad2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5.php(25): Twig_Template->display(Array, Array) #24 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(279): __TwigTemplate_a0dead2e8e9b5a619014e32caeb57c19ea2973ef0e3ebe12ab334fbed58b6fe5->doDisplay(Array, Array) #25 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(253): Twig_Template->displayWithErrorHandling(Array, Array) #26 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Template.php(264): Twig_Template->display(Array) #27 D:\PHP\piwik\piwik\vendor\twig\twig\lib\Twig\Environment.php(292): Twig_Template->render(Array) #28 D:\PHP\piwik\piwik\core\View.php(259): Twig_Environment->render('@CoreHome/getDe...', Array) #29 D:\PHP\piwik\piwik\core\View.php(253): Piwik\View->renderTwigTemplate() #30 D:\PHP\piwik\piwik\plugins\CoreHome\Controller.php(169): Piwik\View->render() #31 [internal function]: Piwik\Plugins\CoreHome\Controller->index() #32 D:\PHP\piwik\piwik\core\FrontController.php(577): call_user_func_array(Array, Array) #33 D:\PHP\piwik\piwik\core\FrontController.php(86): Piwik\FrontController->doDispatch(NULL, NULL, NULL) #34 D:\PHP\piwik\piwik\core\dispatch.php(34): Piwik\FrontController->dispatch() #35 D:\PHP\piwik\piwik\index.php(46): require_once('D:\PHP\piwik\pi...') #36 {main}
I'm using v0.4.0 locally, that might be the problem. Regardless, I will investigate further w/ the stack traces you provided.
I get the same error in 0.4.0. I check vars before ->throwError
var_dump($this->count, strlen($this->buffer), strlen($buffer)); exit; if ($this->count != strlen($this->buffer)) $this->throwError();
And nothing match: int 95237 int 163454 int 167115
I tried last versions of php-less: >= 0.3.7 parse error ine backgorund-image < 0.3.7 not compatible (setImportDir not yet exists) I will try with previous versions of the less files.
There appears to be an open issue about this on lessphp: https://github.com/leafo/lessphp/issues/545, but I can't reproduce it. If you could remove the background-image lines completely (ie, not just commented out) from the less files and test w/ v0.4.0, that might provide some useful information.
@mattab We could avoid using data URIs in less/css, that would probably fix this. What do you think?
Yes I tried it already, it's not totaly ugly:
And a lot of not found stylesheets:
I don't see either image in your comment.
Did you remove only background-images that use data URIs?
Post updated with another images host. I changed only:
M plugins/Morpheus/stylesheets/ui/_map.less M plugins/SegmentEditor/stylesheets/segmentation.less M plugins/UserCountryMap/stylesheets/realtime-map.less M plugins/UserCountryMap/stylesheets/visitor-map.less
Each file contains only one data-uri background-image. If I let only one of them, the parse error re-appears.
Thanks for more info, moving to next milestone. @diosmosis you mentioned less.php library instead, is it a better choice maybe?
lessphp hasn't had a commit since April, less.php has had some activity (though not a lot). Additionally, less.php is a direct port of less.js, so it should be easier for anyone to maintain, and seems more "official" to me.
However, we depend on some behavior of lessphp that might not be implemented in less.php (it might actually be considered a bug...). We'll have to test if we can use it as a drop in replacement.
In the mean time, replacing data URIs in CSS w/ links to actual files will probably solve this problem.
Situation is pretty difficult: two projects have very little activity and commit and unfortunately are not maintained. We don't know what to do in this situation.
I'm wondering also if it affects everyone on Windows or only some particular configuration.
If more people experience the issue please comment here.
OK, I can test an install on Linux tonight.
Install succeed on CentOS, so only on Windows.
Here is how to reproduct:
git clone https://github.com/piwik/piwik.git .
composer update
'misc' n'est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes. Script misc/composer/clean-xhprof.sh handling the pre-update-cmd event returned with an error [RuntimeException] Error Output: 'misc' n'est pas reconnu en tant que commande interne ou externe, un programme exécutable ou un fichier de commandes.
In english: misc not recognized as internal command.
In the browser, "composer is not yet installed..."
composer update --no-scripts
Loading composer repositories with package information Updating dependencies (including require-dev) - Installing leafo/lessphp (v0.4.0) Loading from cache - Installing tedivm/jshrink (v0.5.1) Loading from cache - Installing piwik/decompress (0.1.0) Downloading: 100% - Installing twig/twig (v1.16.0) Loading from cache - Installing symfony/console (v2.5.5) Downloading: 100% - Installing mustangostang/spyc (0.5.1) Loading from cache - Installing piwik/device-detector (2.5.1) Downloading: 100% - Installing sebastian/version (1.0.3) Loading from cache - Installing sebastian/exporter (1.0.2) Downloading: 100% - Installing sebastian/environment (1.1.0) Downloading: 100% - Installing sebastian/diff (1.2.0) Downloading: 100% - Installing sebastian/comparator (1.0.1) Downloading: 100% - Installing symfony/yaml (v2.5.5) Downloading: 100% - Installing doctrine/instantiator (1.0.3) Downloading: 100% - Installing phpunit/php-text-template (1.2.0) Loading from cache - Installing phpunit/phpunit-mock-objects (2.3.0) Downloading: 100% - Installing phpunit/php-timer (1.0.5) Loading from cache - Installing phpunit/php-file-iterator (1.3.4) Loading from cache - Installing phpunit/php-token-stream (1.3.0) Loading from cache - Installing phpunit/php-code-coverage (2.0.11) Loading from cache - Installing phpunit/phpunit (4.3.1) Downloading: 100% - Installing facebook/xhprof (master master) Cloning master symfony/console suggests installing symfony/event-dispatcher () symfony/console suggests installing psr/log (For using the console logger) phpunit/phpunit-mock-objects suggests installing ext-soap (*) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) Writing lock file Generating autoload files
And here appears the backgorund-image error.
maybe this other LESS library for PHP would work better and be more maintained? http://lessphp.gpeasy.com/ cc @diosmosis @tsteur
That's this one: https://github.com/oyejorge/less.php which is the one I mentioned above ;)
Hi @kylekatarnls if you or anyone else experience this problem, please comment here. For now I don't know whether we can fix it as it seems a problem in the library we use. thanks
Hi, I did a fresh install (git clone my fork then composer update) to contribute. But I get an error in my CSS and I can't print more details than this below: /index.php?module=Proxy&action=getCss&cb=745ac1ae282dd708c560a7f9e2a9da1f
PS: Already tried "[Development] disable_merged_assets = 1" in config.ini.php and extend execution time limit.