PCRE2 support

php.internals

Anatoliy Belsky

8 years ago
Hi, I experimented with PCRE2 and created https://github.com/php/php-src/pull/2857 . So far the implementation covers all the core functionality depending on libpcre. It adds no new userland features, only the existing functionality is mapped for now. The internal API is to the big part compatible, though some changed accordingly to the new requirements. Some internal refactoring is yet ongoing to have a cleaner and better tuned patch. Perhaps it's time to move to PCRE2, as PCRE is an ancient bugfix only version. If done, of course it'll create a certain hurdle for non core and older distro versions, but in return we get a modern API which allows for better maintanance, security and opens the door for new features. Regarding performance - from what i could observe PCRE2 is at least not slower. The PR shows, that PCRE2 can serve same way PCRE does. I'd suggest to integrate PCRE2 into 7.3. Will go for an RFC, if necessary. Regards Anatol

Stas Malyshev

8 years ago
Hi!
> I'd suggest to integrate PCRE2 into 7.3. Will go for an RFC, if necessary.
Yes, RFC would be nice. Does the move mean 7.3 could not be built on environments without pcre2? May be OK, but we'll need to make that clear. There may also be other aspects of the code that we need to pay attention to, such as changed defaults, BC with old regexps, etc. but that can be discussed with the RFC.
-- Stas Malyshev smalyshev@gmail.com

Anatoliy Belsky

8 years ago
Hi Stas, On 10/15/2017 11:55 PM, Stanislav Malyshev wrote:
> Hi! > >> I'd suggest to integrate PCRE2 into 7.3. Will go for an RFC, if necessary. > > Yes, RFC would be nice. Does the move mean 7.3 could not be built on > environments without pcre2? May be OK, but we'll need to make that > clear. There may also be other aspects of the code that we need to pay > attention to, such as changed defaults, BC with old regexps, etc. but > that can be discussed with the RFC. >
Yeah, the more i work on it, the more it is clear RFC is the way - too much core. I'm going to write one and come back with it. As we bundle the lib, it can be built on older distros of course. Fe i test on Jessie and it seems fine there. The impact might be only if some would want to use external libpcre2, which might be not available. Regards Anatol