summaryrefslogtreecommitdiff
path: root/ext/pcre
Commit message (Collapse)AuthorAgeFilesLines
* Upgrade bundled PCRE2 to 10.33Anatol Belski2019-05-2534-4461/+7214
|
* Use PKG_CHECK_MODULES to detect valgrind, and share build config with pcreHugh McMaster2019-05-251-29/+3
|
* Normalize comments in *nix build system m4 filesPeter Kokot2019-05-121-5/+2
| | | | | | | | | Normalization include: - Use dnl for everything that can be ommitted when configure is built in favor of the shell comment character # which is visible in the output. - Line length normalized to 80 columns - Dots for most of the one line sentences - Macro definitions include similar pattern header comments now
* Use ZEND_TRY_ASSIGN_REF_... macros for arguments passed to internal function ↵Dmitry Stogov2019-04-241-3/+3
| | | | by reference
* ext/pcre/config0.m4: add ac_cv_have_pcre2_jit variableArtem Panfilov2019-04-161-28/+30
| | | | | | | | | | The HAVE_PCRE_JIT_SUPPORT check uses AC_RUN_IFELSE, which is not available when cross-compiling. As a fallback, JIT support is enabled based on CPU architecture. However, this may be wrong, e.g. when the JIT the feature was not enabled in the pcre2 build. Add a cache variable for the PCRE JIT feature to make it possible to override the check.
* Disable PACKAGE_* preprocessor symbolsPeter Kokot2019-04-132-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Autoconf defines PACKAGE_* symbols: - PACKAGE_NAME - PACKAGE_VERSION - PACKAGE_TARNAME - PACKAGE_STRING - PACKAGE_BUGREPORT - PACKAGE_URL and appends them to the generated config.h.in files. With AC_INIT change via afd52f9d9986d92dd0c63832a07ab1a16bf11d53 where package version, URL, bug report location and similar meta data are defined, these preprocessor macros are then non empty strings in the generated configuration header file. When using phpize, PHP shares the config files in extensions, warnings of redefined macros appear, such as: - `warning: 'PACKAGE_NAME' macro redefined` This patch now disables these non utilized symbols in the generated config header files. Better practice would be to include only API specific headers where needed but this would require even more refactorings. Some extensions such as pcre, pgsql, and pdo_pgsql solve this issue by undefining some of these symbols before including the library configuration headers in the code also. Because these symbols can be defined by any library which uses Autotools. Additionally, the unused PACKAGE_* symbols were cleaned for the bundled libmbfl library and with this patch not needed undef code removed.
* Remove checks for locale.h, setlocale, localeconvPeter Kokot2019-04-072-37/+1
| | | | | | | | | | | | | | | | | | | The `<loccale.h>` header file, setlocale, and localeconv are part of the standard C89 [1] and on current systems can be used unconditionally. Since PHP 7.4 requires at least C89 or greater, the `HAVE_LOCALE_H`, `HAVE_SETLOCALE`, and `HAVE_LOCALECONV` symbols defined by Autoconf in configure.ac [2] can be ommitted and simplifed. The bundled libmagic (file) has also been patched already in version 5.35 and up in upstream location so when it will be patched also in php-src the check for locale.h header is still left in the configure.ac and in windows headers definition file. [1] https://port70.net/~nsz/c/c89/c89-draft.html#4.4 [2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4 Omit the bundled libmagic files
* Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-03-312-0/+15
|\ | | | | | | | | * PHP-7.3: Fix #77827: preg_match does not ignore \r in regex flags
| * Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-03-312-0/+15
| |\ | | | | | | | | | | | | * PHP-7.2: Fix #77827: preg_match does not ignore \r in regex flags
| | * Fix #77827: preg_match does not ignore \r in regex flagsChristoph M. Becker2019-03-312-0/+15
| | |
* | | Make PCRE cache per-request on CLINikita Popov2019-03-262-16/+30
| | | | | | | | | | | | | | | | | | There will only be one request on the CLI SAPI, so there is no advantage to having a persistent PCRE cache. Using a non-persistent cache allows us to use arbitrary strings as cache keys.
* | | Merge branch 'PHP-7.3' into PHP-7.4Remi Collet2019-03-221-0/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: ensure pcre.jit=1 for this test
| * | ensure pcre.jit=1 for this testRemi Collet2019-03-221-0/+2
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Remi Collet2019-03-221-0/+3
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: ensure pcre.jit=1 for these tests
| * | Merge branch 'PHP-7.2' into PHP-7.3Remi Collet2019-03-221-0/+3
| |\ \ | | |/ | | | | | | | | | * PHP-7.2: ensure pcre.jit=1 for these tests
| | * ensure pcre.jit=1 for these testsRemi Collet2019-03-221-0/+3
| | |
| | * Sync leading and final newlines in *.phpt sectionsPeter Kokot2018-10-1527-34/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| | * Trim trailing whitespace in *.phptPeter Kokot2018-10-1430-50/+50
| | |
| | * Sync leading and final newlines in source code filesPeter Kokot2018-10-142-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
| | * Trim trailing whitespace in source code filesPeter Kokot2018-10-132-3/+3
| | |
| | * Convert CRLF line endings to LFPeter Kokot2018-10-131-27/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch simplifies line endings tracked in the Git repository and syncs them to all include the LF style instead of the CRLF files. Newline characters: - LF (\n) (*nix and Mac) - CRLF (\r\n) (Windows) - CR (\r) (old Mac, obsolete) To see which line endings are in the index and in the working copy the following command can be used: `git ls-files --eol` Git additionally provides `.gitattributes` file to specify if some files need to have specific line endings on all platforms (either CRLF or LF). Changed files shouldn't cause issues on modern Windows platforms because also Git can do output conversion is core.autocrlf=true is set on Windows and use CRLF newlines in all files in the working tree. Unless CRLF files are tracked specifically, Git by default tracks all files in the index using LF newlines.
| | * Fixed possible incorrect "mark" usageDmitry Stogov2018-01-091-0/+5
| | |
| | * year++Xinchen Hui2018-01-022-2/+2
| | |
| | * Merge branch 'PHP-7.1' into PHP-7.2Anatol Belski2017-12-061-1/+3
| | |\ | | | | | | | | | | | | | | | | * PHP-7.1: Fix yet one data race in PCRE
| | | * Fix yet one data race in PCREAnatol Belski2017-12-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCRE 8.x initializes the pattern compiler on demand during the first pcre_study call. It could be worse, but since the compiled patterns are cached, the locking impact is minimal. PCRE 10.x always compiles the pattern and thread sanitizer doesn't complain about the compiler initialization, thus the newer PCRE version seems to be unafected.
* | | | Remove HAVE_PCRE/HAVE_BUNDLED_PCRE checksNikita Popov2019-03-222-12/+0
| | | | | | | | | | | | | | | | PCRE is always available.
* | | | Try to create interned strings in preg_split as wellNikita Popov2019-03-211-16/+12
| | | | | | | | | | | | | | | | | | | | And convert last_match to last_match_offset, which is more convenient now.
* | | | Cleanup add_offset_pair APINikita Popov2019-03-211-61/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Accept the two offsets directly, rather than doing length calculations at all callsites. Also extract the logic to create a possibly interned string. Switch the split implementation to work on a char* subject internally, because ZSTR_VAL(subject_str) is a mouthful...
* | | | Fix bug #73948Nikita Popov2019-03-214-8/+128
| | | | | | | | | | | | | | | | | | | | | | | | If PREG_UNMATCHED_AS_NULL is used, make sure that unmatched capturing groups at the end are also set to null, rather than just those in the middle.
* | | | Merge branch 'PHP-7.3' into PHP-7.4Remi Collet2019-03-192-2/+2
|\ \ \ \ | |/ / / | | | | | | | | | | | | * PHP-7.3: fix test for upcoming pcre2 10.33
| * | | fix test for upcoming pcre2 10.33Remi Collet2019-03-192-2/+2
| | | | | | | | | | | | | | | | "group name ..." => "subpattern name ..."
* | | | Respect OFFSET_CAPTURE when padding preg_match_all() resultsNikita Popov2019-03-193-16/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This issue was mentioned in bug #73948. The PREG_PATTERN_ORDER padding was performed without respecting the PREF_OFFSET_CAPTURE flag, which resulted in unmatched subpatterns being either null or [null, -1] depending on where they occur. Now they will always be [null, -1], consistent with other usages.
* | | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-03-194-11/+20
|\ \ \ \ | |/ / /
| * | | Fixed bug #76127Nikita Popov2019-03-194-11/+20
| | | | | | | | | | | | | | | | | | | | Per documentation, and consistent with other preg functions, we should return false if an error occurred.
* | | | Don't create a new array for empty/null match every timeNikita Popov2019-03-192-19/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If PREG_OFFSET_CAPTURE is used, unmatched subpatterns will be either [null, -1] or ['', -1] depending on PREG_UNMATCHED_AS_NULL mode. Instead of creating a new array like this every time, cache it inside a global (per-request -- could make it immutable though). Additionally check whether the subpattern is an empty string or single character string and use an existing interned string in that case. Empty / single-char subpatterns are common, so let's avoid allocating strings for them.
* | | | Revert unintended changeNikita Popov2019-03-191-1/+0
| | | | | | | | | | | | | | | | | | | | I wanted to cache subpat names, but we can't do that because the cache relives request boundaries.
* | | | Use zend_string for subpat_names tableNikita Popov2019-03-191-24/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When used with preg_match_all or preg_replace_callback(_array), subpattern names can be used in the matches array many times. Switch the subpat_names table to use zend_string, so we don't have to allocate a new string every time. Also don't bother creating the table if no $matches were passed. This might be a regression for the case where preg_match() is used with many trailing named subpatterns that are skipped in the result array, but that seems rather contrived.
* | | | Avoid copying subpat twice if named subpats are usedNikita Popov2019-03-191-30/+23
| | | |
* | | | Fix #77094: Add flags support for pcre_replace_callback(_array)Nikita Popov2019-03-192-161/+225
| | | |
* | | | Fixed bug #72685Nikita Popov2019-03-182-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently have a large performance problem when implementing lexers working on UTF-8 strings in PHP. This kind of code tends to perform a large number of matches at different offsets on a single string. This is generally fast. However, if /u mode is used, the full string will be UTF-8 validated on each match. This results in quadratic runtime. This patch fixes the issue by adding a IS_STR_VALID_UTF8 flag, which is set when we have determined that the string is valid UTF8 and further validation is skipped. A limitation of this approach is that we can't set the flag for interned strings. I think this is not a problem for this use-case which will generally work on dynamic data. If we want to use this flag for other purposes as well (mbstring?) then it might be worthwhile to UTF-8 validate strings during interning. But right now this doesn't seem useful.
* | | | Accept zend_string* instead of char* in php_pcre_match_impl()Nikita Popov2019-03-182-3/+6
| | | |
* | | | Add AS_HELP_STRING to *nix build configure optionsPeter Kokot2019-03-071-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Autoconf's default AS_HELP_STRING macro can properly format help strings [1] so watching out if columns are aligned manually is not anymore. [1] https://www.gnu.org/software/autoconf/manual/autoconf.html#Pretty-Help-Strings
* | | | Remove more zpp error testsNikita Popov2019-03-0511-443/+0
| | | |
* | | | Implement fine-grained conflict handlingNikita Popov2019-02-201-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | Tests can specify conflict keys, either in --CONFLICTS-- or a per-directory CONFLICTS file. Non-conflicting tests may be run in parallel.
* | | | fix build with external libpcre2Remi Collet2019-02-191-1/+1
| | | |
* | | | run-tests.php: experimental parallel testing supportAndrea Faulds2019-02-181-0/+0
| | | |
* | | | Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes the so called local variables defined per file basis for certain editors to properly show tab width, and similar settings. These are mainly used by Vim and Emacs editors yet with recent changes the once working definitions don't work anymore in Vim without custom plugins or additional configuration. Neither are these settings synced across the PHP code base. A simpler and better approach is EditorConfig and fixing code using some code style fixing tools in the future instead. This patch also removes the so called modelines for Vim. Modelines allow Vim editor specifically to set some editor configuration such as syntax highlighting, indentation style and tab width to be set in the first line or the last 5 lines per file basis. Since the php test files have syntax highlighting already set in most editors properly and EditorConfig takes care of the indentation settings, this patch removes these as well for the Vim 6.0 and newer versions. With the removal of local variables for certain editors such as Emacs and Vim, the footer is also probably not needed anymore when creating extensions using ext_skel.php script. Additionally, Vim modelines for setting php syntax and some editor settings has been removed from some *.phpt files. All these are mostly not relevant for phpt files neither work properly in the middle of the file.
* | | | Fix bogus $PHP_PCRE_REGEX checksNikita Popov2019-02-011-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | This variable was dropped in the pkg-config migration, which resulted in spurious warnings about using valgrind with external PCRE. Fix the checks to use the right variable.
* | | | Remove yearly range from copyright noticeZeev Suraski2019-01-302-2/+2
| | | |
* | | | Implement typed propertiesNikita Popov2019-01-111-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/typed_properties_v2 This is a squash of PR #3734, which is a squash of PR #3313. Co-authored-by: Bob Weinand <bobwei9@hotmail.com> Co-authored-by: Joe Watkins <krakjoe@php.net> Co-authored-by: Dmitry Stogov <dmitry@zend.com>