Commit graph

467 commits

Author SHA1 Message Date
Anatol Belski
91407fb82d Fix wrong return 2017-11-14 21:44:46 +01:00
Anatol Belski
13696d7aae Use already available pattern length, fix signedness warnings 2017-11-14 16:36:33 +01:00
Anatol Belski
a385993c0c Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix UTF check in pcre_grep
2017-11-14 13:56:25 +01:00
Anatol Belski
0d13323915 Fix UTF check in pcre_grep
In this case it loops through different subjects without looking for sub
matches and matches are done against the same pattern. Thus, don't reset
the UTF check flag but use it to check whether JIT should be used and
otherwise let PCRE to do the job according to what was saved into the
pattern.
2017-11-14 13:49:06 +01:00
Anatol Belski
0618d7d2ee Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix uninitialized flag when JIT is disabled
2017-11-14 10:14:09 +01:00
Anatol Belski
3c241ea326 Fix uninitialized flag when JIT is disabled 2017-11-14 10:12:55 +01:00
Xinchen Hui
266f19babb Added PCRE_JIT_SUPPORT flag 2017-11-14 11:02:16 +08:00
Anatol Belski
e8ac7d8dd5 Fix calculation as sync with 48cee6d1 2017-11-14 00:01:52 +01:00
Dmitry Stogov
81dd6de3a9 Eliminated redundand code 2017-11-14 01:43:54 +03:00
Dmitry Stogov
48cee6d1e9 We don't need to calculate size of offset array, because pcre2_match_data_create() already takes size in pairs. 2017-11-14 00:49:03 +03:00
Anatol Belski
f4edd0899f Put hardcoded value into macro 2017-11-13 21:33:13 +01:00
Anatol Belski
a5bc5aed71 Patch core for PCRE2 support
RFC https://wiki.php.net/rfc/pcre2-migration
2017-11-13 19:37:38 +01:00
Dmitry Stogov
f5664a1492 PCRE cache is "thread-local" 2017-11-01 15:13:49 +03:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Dmitry Stogov
160f6d6267 single check is enough 2017-10-31 11:07:42 +03:00
Dmitry Stogov
2e83924682 Added zend_hash_add_new_mem/zend_hash_str_add_new_mem. Use them to add new elements into PCRE cache (we checked the existance before). 2017-10-31 10:43:10 +03:00
Dmitry Stogov
ef90e37bd1 Fixed bug #75089 (preg_grep() is not reporting PREG_BAD_UTF8_ERROR after first input string) 2017-08-18 14:56:28 +03:00
Anatol Belski
8a287c0ea0 Upgrade bundled PCRE to 8.41
HEADSUP! With PCRE 8.39 the JIT related code was changed in the way,
that additional valgrind options became almost unavoidable. Valgrind
had it already sometimes hard with JIT, now there are seem to be more
cases requiring special valgrind options.

For this reason, the new configure option --with-pcre-valgrind was
introduced. The option is development/debugging only and turns on the
Valgrind related pieces in PCRE, so then false positives are avoided
to the big part. In addition, run-tests.php was added a new valgrind
option, when the leak check is enabled and the test filepath contains
pcre.

Thus, to debug the code related to PCRE with JIT enabled, two things
would likely make sense

  - configure --with-pcre-valgrind
  - valgrind option --smc-check=all if run-tests.php is not used

The checks so far reveal no new issues.
2017-07-11 17:01:59 +02:00
Dmitry Stogov
29653da385 Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()). 2017-07-07 09:54:21 +03:00
Dmitry Stogov
f626a783b6 Avoid string duplication in preg_split() 2017-06-28 00:43:55 +03:00
Nikita Popov
035a27cbc6 Only compute callback name in error cases
Mostly the callback name is only used to report an error. Try to
avoid calculating it if no error occurred.
2017-06-25 18:45:59 +02:00
Dmitry Stogov
71daef93bc preg_replace() optimization 2017-06-07 13:50:16 +03:00
Dmitry Stogov
81a6ee9aa4 Avoid string reallocations in preg_quote() 2017-06-06 13:56:19 +03:00
Dmitry Stogov
4f947e1f40 PCRE_EXTRA_MARK is useful only for preg_replace_callbakc().
Removed branch expectations.
2017-06-02 14:34:31 +03:00
Dmitry Stogov
8dc6b41011 Added support for PCRE JIT fast path API 2017-06-02 13:14:33 +03:00
Dmitry Stogov
32200e0b69 Avoid double copying 2017-05-31 02:14:17 +03:00
Dmitry Stogov
c45e3632a2 Don't allocate empty strings, use single interned string instead. 2017-05-30 10:02:04 +03:00
Nicolas Grekas
3c43510b19 add PREG_UNMATCHED_AS_NULL flag to allow distinguish between unmatched subpatterns and empty matches 2017-05-29 11:40:29 +02:00
Dmitry Stogov
dd4a78b631 Don't separate output arguments 2017-05-23 17:18:05 +03:00
Joe Watkins
ee6aaee83a
Merge branch 'pull-request/1303'
* pull-request/1303:
  Distinguish between unmatched subpatterns and empty matches in preg_*()
  news entry for PR #1303
2017-01-06 05:48:31 +00:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Christoph M. Becker
1b7e014d1c Merge branch 'PHP-7.1' 2016-11-26 16:11:08 +01:00
Christoph M. Becker
09085ac02c Merge branch 'PHP-7.0' into PHP-7.1 2016-11-26 16:09:45 +01:00
Christoph M. Becker
003727d851 Fix #73612: preg_*() may leak memory
We have to make sure that collectible zvals end up in the GC root
buffer, to avoid memory leaks.
2016-11-26 15:34:27 +01:00
Xinchen Hui
6ee8581a0e Removed not used field 2016-11-20 15:52:52 +08:00
Xinchen Hui
0f5d03025f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73483 (Segmentation fault on pcre_replace_callback)
  Fix #73219 (fix acinclude when / is present)
  make it possible to show specific help pages without interactive session

Conflicts:
	acinclude.m4
2016-11-20 15:46:53 +08:00
Xinchen Hui
ebfd93f725 Fixed bug #73483 (Segmentation fault on pcre_replace_callback) 2016-11-20 15:44:27 +08:00
Xinchen Hui
7778bdcd04 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixed bug #73392 (A use-after-free in zend allocator management)
2016-10-28 21:21:35 +08:00
Xinchen Hui
e5aa365147 Fixed bug #73392 (A use-after-free in zend allocator management) 2016-10-28 21:21:24 +08:00
Nikita Popov
b1fc1fb937 Normalize preg_replace_callback() return value
One particular error case was returning the argument without
casting to string.
2016-10-15 23:58:26 +02:00
Anatol Belski
dd604015be rename publicly exposed symbol to avoid name conflicts
(cherry picked from commit 730288ae41)
2016-10-14 02:08:14 +02:00
Stanislav Malyshev
0362d61ab7 Fix potential overflows in php_pcre_replace_impl
(cherry picked from commit 9c50ba42d6)
2016-10-14 01:57:55 +02:00
Anatol Belski
730288ae41 rename publicly exposed symbol to avoid name conflicts 2016-10-13 15:23:50 +02:00
Stanislav Malyshev
9c50ba42d6 Fix potential overflows in php_pcre_replace_impl 2016-10-12 23:07:47 -07:00
Anatol Belski
f7e5481a10 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix bug #73121 Bundled PCRE doesn't compile because JIT isn't supported on s390
2016-09-23 01:55:17 +02:00
Anatol Belski
54d8053ac5 Fix bug #73121 Bundled PCRE doesn't compile because JIT isn't supported on s390 2016-09-23 01:52:42 +02:00
Andrea Faulds
fc5497cb92 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-11 22:46:20 +01:00
Andrea Faulds
d690014bf3 Remove zpp fallback code (always use Fast ZPP)
Squashed commit of the following:

commit 3e27fbb3d2
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Sep 11 19:14:37 2016 +0100

    Keep dummy FAST_ZPP macro for compatibility

commit 8a7cfd00de
Author: Andrea Faulds <ajf@ajf.me>
Date:   Mon Sep 5 22:36:03 2016 +0100

    Remove FAST_ZPP macro and plain zpp fallback code
2016-09-11 22:44:46 +01:00
Stanislav Malyshev
9650b8e241 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Implement #47456: Missing PCRE option 'J'
2016-09-05 00:39:01 -07:00
Stanislav Malyshev
92db92c620 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Implement #47456: Missing PCRE option 'J'
2016-09-05 00:38:57 -07:00