Skip to content

Commit 870a667

Browse files
committed
- Updated bundled PCRE library to version 2.08
- Made it possible to specify external location of the PCRE library - Reworked PCRE extension to use updated PCRE library API Hopefully now everything behaves just like Perl..
1 parent 61a3c14 commit 870a667

35 files changed

+6366
-373
lines changed

ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP 4.0 CHANGE LOG ChangeLog
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33

44
?? ?? 1999, Version 4.0 Beta 3
5+
- Reworked preg_* functions according to the new PCRE API, which also made
6+
them behave much more like Perl ones (Andrey)
7+
- Made it possible to specify external location of PCRE library (Andrey)
8+
- Updated bundled PCRE library to version 2.08 (Andrey)
59
- count()/is_array/is_object... speedups. (Thies)
610
- OCI8 supports appending and positioning when saving LOBs (Thies)
711
- Added metaphone support (Thies)

ext/pcre/config.h.stub

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/* define if you want to use the PCRE extension */
22
#define HAVE_PCRE 0
33

4+
#define HAVE_BUNDLED_PCRE 0

ext/pcre/config.m4

+42-11
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,51 @@ dnl if DIR is supplied, we'll use that for linking
66

77
AC_MSG_CHECKING(whether to include PCRE support)
88
AC_ARG_WITH(pcre-regex,
9-
[ --without-pcre-regex Don't include Perl Compatible Regular Expressions support],[
10-
if test "$withval" = "yes"; then
11-
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
12-
PCRE_SUBDIR="pcrelib"
13-
AC_DEFINE(HAVE_PCRE, 1)
14-
AC_MSG_RESULT(yes)
15-
PHP_EXTENSION(pcre)
16-
else
17-
AC_MSG_RESULT(no)
18-
fi
9+
[ --without-pcre-regex Don't include Perl Compatible Regular Expressions support
10+
Use --with-pcre-regex=DIR to specify DIR where PCRE include
11+
and library files are located],[
12+
case "$withval" in
13+
no)
14+
AC_MSG_RESULT(no)
15+
;;
16+
yes)
17+
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
18+
PCRE_SUBDIR="pcrelib"
19+
AC_DEFINE(HAVE_BUNDLED_PCRE, 1)
20+
AC_MSG_RESULT(yes)
21+
PHP_EXTENSION(pcre)
22+
;;
23+
*)
24+
if test -f $withval/pcre.h ; then
25+
changequote({,})
26+
pcre_major=`grep PCRE_MAJOR $withval/pcre.h | sed -e 's/[^0-9]//g'`
27+
pcre_minor=`grep PCRE_MINOR $withval/pcre.h | sed -e 's/[^0-9]//g'`
28+
changequote([,])
29+
pcre_version=$pcre_major$pcre_minor
30+
if test "$pcre_version" -ge 208; then
31+
AC_ADD_INCLUDE($withval)
32+
else
33+
AC_MSG_ERROR(PCRE extension requires PCRE library version >= 2.08)
34+
fi
35+
else
36+
AC_MSG_ERROR(Could not find pcre.h in $withval)
37+
fi
38+
39+
if test -f $withval/libpcre.a ; then
40+
AC_ADD_LIBRARY_WITH_PATH(pcre, $withval)
41+
else
42+
AC_MSG_ERROR(Could not find libpcre.a in $withval)
43+
fi
44+
45+
AC_DEFINE(HAVE_PCRE, 1)
46+
AC_MSG_RESULT(yes)
47+
PHP_EXTENSION(pcre)
48+
;;
49+
esac
1950
],[
2051
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
2152
PCRE_SUBDIR="pcrelib"
22-
AC_DEFINE(HAVE_PCRE, 1)
53+
AC_DEFINE(HAVE_BUNDLED_PCRE, 1)
2354
AC_MSG_RESULT(yes)
2455
PHP_EXTENSION(pcre)
2556
])

ext/pcre/config0.m4

+42-11
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,51 @@ dnl if DIR is supplied, we'll use that for linking
66

77
AC_MSG_CHECKING(whether to include PCRE support)
88
AC_ARG_WITH(pcre-regex,
9-
[ --without-pcre-regex Don't include Perl Compatible Regular Expressions support],[
10-
if test "$withval" = "yes"; then
11-
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
12-
PCRE_SUBDIR="pcrelib"
13-
AC_DEFINE(HAVE_PCRE, 1)
14-
AC_MSG_RESULT(yes)
15-
PHP_EXTENSION(pcre)
16-
else
17-
AC_MSG_RESULT(no)
18-
fi
9+
[ --without-pcre-regex Don't include Perl Compatible Regular Expressions support
10+
Use --with-pcre-regex=DIR to specify DIR where PCRE include
11+
and library files are located],[
12+
case "$withval" in
13+
no)
14+
AC_MSG_RESULT(no)
15+
;;
16+
yes)
17+
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
18+
PCRE_SUBDIR="pcrelib"
19+
AC_DEFINE(HAVE_BUNDLED_PCRE, 1)
20+
AC_MSG_RESULT(yes)
21+
PHP_EXTENSION(pcre)
22+
;;
23+
*)
24+
if test -f $withval/pcre.h ; then
25+
changequote({,})
26+
pcre_major=`grep PCRE_MAJOR $withval/pcre.h | sed -e 's/[^0-9]//g'`
27+
pcre_minor=`grep PCRE_MINOR $withval/pcre.h | sed -e 's/[^0-9]//g'`
28+
changequote([,])
29+
pcre_version=$pcre_major$pcre_minor
30+
if test "$pcre_version" -ge 208; then
31+
AC_ADD_INCLUDE($withval)
32+
else
33+
AC_MSG_ERROR(PCRE extension requires PCRE library version >= 2.08)
34+
fi
35+
else
36+
AC_MSG_ERROR(Could not find pcre.h in $withval)
37+
fi
38+
39+
if test -f $withval/libpcre.a ; then
40+
AC_ADD_LIBRARY_WITH_PATH(pcre, $withval)
41+
else
42+
AC_MSG_ERROR(Could not find libpcre.a in $withval)
43+
fi
44+
45+
AC_DEFINE(HAVE_PCRE, 1)
46+
AC_MSG_RESULT(yes)
47+
PHP_EXTENSION(pcre)
48+
;;
49+
esac
1950
],[
2051
EXTRA_LIBS="-L$abs_builddir/ext/pcre/pcrelib -lpcre $EXTRA_LIBS"
2152
PCRE_SUBDIR="pcrelib"
22-
AC_DEFINE(HAVE_PCRE, 1)
53+
AC_DEFINE(HAVE_BUNDLED_PCRE, 1)
2354
AC_MSG_RESULT(yes)
2455
PHP_EXTENSION(pcre)
2556
])

ext/pcre/pcrelib/ChangeLog

+80
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,86 @@ ChangeLog for PCRE
22
------------------
33

44

5+
Version 2.08 31-Aug-99
6+
----------------------
7+
8+
1. When startoffset was not zero and the pattern began with ".*", PCRE was not
9+
trying to match at the startoffset position, but instead was moving forward to
10+
the next newline as if a previous match had failed.
11+
12+
2. pcretest was not making use of PCRE_NOTEMPTY when repeating for /g and /G,
13+
and could get into a loop if a null string was matched other than at the start
14+
of the subject.
15+
16+
3. Added definitions of PCRE_MAJOR and PCRE_MINOR to pcre.h so the version can
17+
be distinguished at compile time, and for completeness also added PCRE_DATE.
18+
19+
5. Added Paul Sokolovsky's minor changes to make it easy to compile a Win32 DLL
20+
in GnuWin32 environments.
21+
22+
23+
Version 2.07 29-Jul-99
24+
----------------------
25+
26+
1. The documentation is now supplied in plain text form and HTML as well as in
27+
the form of man page sources.
28+
29+
2. C++ compilers don't like assigning (void *) values to other pointer types.
30+
In particular this affects malloc(). Although there is no problem in Standard
31+
C, I've put in casts to keep C++ compilers happy.
32+
33+
3. Typo on pcretest.c; a cast of (unsigned char *) in the POSIX regexec() call
34+
should be (const char *).
35+
36+
4. If NOPOSIX is defined, pcretest.c compiles without POSIX support. This may
37+
be useful for non-Unix systems who don't want to bother with the POSIX stuff.
38+
However, I haven't made this a standard facility. The documentation doesn't
39+
mention it, and the Makefile doesn't support it.
40+
41+
5. The Makefile now contains an "install" target, with editable destinations at
42+
the top of the file. The pcretest program is not installed.
43+
44+
6. pgrep -V now gives the PCRE version number and date.
45+
46+
7. Fixed bug: a zero repetition after a literal string (e.g. /abcde{0}/) was
47+
causing the entire string to be ignored, instead of just the last character.
48+
49+
8. If a pattern like /"([^\\"]+|\\.)*"/ is applied in the normal way to a
50+
non-matching string, it can take a very, very long time, even for strings of
51+
quite modest length, because of the nested recursion. PCRE now does better in
52+
some of these cases. It does this by remembering the last required literal
53+
character in the pattern, and pre-searching the subject to ensure it is present
54+
before running the real match. In other words, it applies a heuristic to detect
55+
some types of certain failure quickly, and in the above example, if presented
56+
with a string that has no trailing " it gives "no match" very quickly.
57+
58+
9. A new runtime option PCRE_NOTEMPTY causes null string matches to be ignored;
59+
other alternatives are tried instead.
60+
61+
62+
Version 2.06 09-Jun-99
63+
----------------------
64+
65+
1. Change pcretest's output for amount of store used to show just the code
66+
space, because the remainder (the data block) varies in size between 32-bit and
67+
64-bit systems.
68+
69+
2. Added an extra argument to pcre_exec() to supply an offset in the subject to
70+
start matching at. This allows lookbehinds to work when searching for multiple
71+
occurrences in a string.
72+
73+
3. Added additional options to pcretest for testing multiple occurrences:
74+
75+
/+ outputs the rest of the string that follows a match
76+
/g loops for multiple occurrences, using the new startoffset argument
77+
/G loops for multiple occurrences by passing an incremented pointer
78+
79+
4. PCRE wasn't doing the "first character" optimization for patterns starting
80+
with \b or \B, though it was doing it for other lookbehind assertions. That is,
81+
it wasn't noticing that a match for a pattern such as /\bxyz/ has to start with
82+
the letter 'x'. On long subject strings, this gives a significant speed-up.
83+
84+
585
Version 2.05 21-Apr-99
686
----------------------
787

0 commit comments

Comments
 (0)