Comments (8)
I believe it has to do with the use of named back-references (https://github.com/oncletom/wp-less/search?q=%3FP%3C&ref=cmdform&type=Code) in preg_replace_callback, which is only supported in PHP 5.3 and above, from what I gather.
In PHP 5.2, those back-references fall through as numerically keyed arrays.
A temporary work-around for PHP 5.2 users is to change the array keys to their expected numerical index, as shown below from Plugin.class.php, around line 124.
protected function _filterStylesheetUri($matches)
{
if (preg_match('#^(http|@|data:|/)#Ui', $matches[2])) {
return $matches[0];
}
return sprintf('url(%s%s%1$s)',
$matches[1],
$this->_TmpBaseDir . '/' . $matches[2]
);
}
Long-term, the plugin author should cite PHP 5.3 as the minimum requirement, or simply remove the named back-reference dependencies.
A reasonable compromise, without sacrificing too much readability, is to pull the regex match into local variables via list:
protected function _filterStylesheetUri($matches)
{
list($full, $quote, $url) = $matches;
if (preg_match('#^(http|@|data:|/)#Ui', $url)) {
return $full;
}
return sprintf('url(%s%s%1$s)',
$quote,
$this->_TmpBaseDir . '/' . $url
);
}
from wp-less.
hmm, I would like to see that plugin having no greater requirements than wordpress, which has php 5.2 afair.
this would only lead to lots of negative reviews, since hosters don't always have the latest and greatest...
from wp-less.
Back-reference are available in PHP 5.2 — http://www.php.net/manual/en/regexp.reference.back-references.php
from wp-less.
@oncletom Yes, but it seems that named back-references were not allowed to propagate outside of the pattern until PHP 5.3.
from wp-less.
I've found a Stack Overflow answer that seems to reinforce the above assertion: http://stackoverflow.com/a/5255199
from wp-less.
OK well, if it's the only blocking problem for PHP 5.2, I invite you to open a pull request with this change.
Thanks for coining the problem :-)
from wp-less.
pull request here: #39
from wp-less.
I close the issue thanks to #39 and ship that in a new release (because I forgot to do it 2 months ago).
from wp-less.
Related Issues (20)
- Notice: Undefined index: extension HOT 1
- Add oncletom/wp-less to Packagist HOT 1
- Make package autoloadable HOT 2
- Embedding into a Theme HOT 2
- oyejorge less php library should be updated
- Mixins with multiple arguments HOT 1
- Combine Less Files HOT 2
- Update "oyejorge" LESS compiler
- Use class from css file in another directory HOT 3
- Recompiling Not Working HOT 2
- How to set Upload Dir and set Upload Url correctly? HOT 1
- Debug Mode: Warnings in TinyMCE HOT 1
- composer vendor directory missing from WordPress package HOT 3
- Wp-less parse error: syntax error, unexpected 'const' (T_CONST) HOT 3
- 1.9.3-3 takes my site down. HOT 6
- gargabecollector class php is throwing errors on lines 86 88 91
- Undefined index: port / path / index in lines 312 / 316
- Less_Exception_Compiler
- $lessfile_in_theme error on Windows
- Deprecated: Creation of dynamic property WPLessPlugin::$_TmpBaseDir
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-less.