First I love features. It's amazing, and has saved me a mountain of time. Second let me say, I'm not the most advanced RegExer and am only a year or so into Drupal. So if I've made a mistake, just let me apologize in advance and feel free to hit me with a clue stick.
On line 151 of features.admin.inc, there is a regex version check that uses named sub-patterns. It uses a syntax for the patterns that was only introduced in PHP 5.2.2.
?<name>\d+
vs
?P<name>\d+.
The changelog below indicates that the ?P syntax should work in both 5.1 and 5.2+.
http://php.net/manual/en/function.preg-match.php
This is what is in features:
preg_match('/^(?<core>\d+\.x)-(?<major>\d+)\.(?<patch>\d+)-?(?<extra>\w+)?$/', $element['#value'], $matches);
I believe this *should* work in 5.1 and 5.2+. It works in my install.
preg_match('/^(?P<core>\d+\.x)-(?P<major>\d+)\.(?P<patch>\d+)-?(?P<extra>\w+)?$/', $element['#value'], $matches);
Those of us presently trapped by the packaged PHP install on Centos/RHEL 5.x would love to see it stay 5.1 compatible, for a little while at least. Of course, I know that can be a pain in the butt, and would understand if you didn't want to have to worry about older installs.
Again, thanks for the amazing creation that is features.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | features.admin_.inc-670788.patch | 719 bytes | irakli |
| #3 | features.admin_.inc_.patch | 719 bytes | irakli |
| #1 | features5.1compat01.patch | 711 bytes | andrewfn |
Comments
Comment #1
andrewfn commentedWorks great for me. Thank you so much!
Here is a patch to implement it
Comment #2
irakli commentedHit the same problem. Weirdly enough it was breaking on PHP 5.2.9 so apparently even PHP 5.2.2+ is not safe.
Comment #3
irakli commentedBy the way, patch attached by @andrewfn is a reverse patch (new and old files are swapped). Linux patch command will understand it and will ask at command prompt what to do, but such patch would break drush make, so attaching a fixed version as well.
Comment #4
irakli commentedOr with the patch name that includes this issue's node_id, for reference (sorry for double submission):
Comment #5
irakli commentedP.S. it was happening on PHP 5.2.9 because even though PHP version was > 5.2.2 the PCRE (for some reason) was older than 7.0. So such things can happen too, apparently.
Comment #6
yhahn commentedThank you. Committed: http://drupal.org/cvs?commit=324890