I happen to think that this is php_addslashes() problem, not PCRE's.
When 0 is passed for the length of the string to php_addslashes() it
assumes that we want to process the whole string and happily runs
strlen() on it. That is bad. It should respect the length and return
an empty string if it's 0.
Draft 3 of IEEE 1003.1 200x, "2.2 The Compilation Environment"
All identifiers that begin with an underscore and either an uppercase
letter or another underscore are always reserved for any use by the
implementation.
The following new/revived shared modules are available now:
... MySQL (*)
... PCRE (*)
... Session
... SWF
(*) capable of using bundled library or external library
All changes:
The m4 macro PHP_EXTENSION was revamped. Uses LIB_BUILD now.
This effectively means that all extensions have to use dynlib.
ext/mysql/config.m4 was revamped.
Uses LIB_BUILD for building bundled library.
ext/pcre/config.m4 was revamped.
Uses LIB_BUILD for building bundled library.
ext/ext_skel was changed to reflect that more modules should be
compileable as shared module.
ext/Makefile.in has been simplified enormously.
Dependencies are now stored in the build tree.
Empty dependencies are not generated by buildconf anymore. They
are now dynamically created during the build process.
Implicit rules for .S were removed.
The NO_RECURSION feature was removed.
"libs.mk" has been added to all cvsignore files in ext.
* Makefile header is now completely dynamic
* Absolute paths in (top_)?(src|build)dir and VPATH
(fixes Tru64 support)
* VPATH does not contain variables anymore
(fixes UnixWare support)
- added support for externally built modules,
- improved support for in-tree shared modules,
- fixed diversion bugs,
- configure displays some informative messages,
- faster static build
(libtool isn't used anymore for compiling non-PIC objects),
- dependencies comparable to automake's without requiring GNU make or GCC,
- working make clean for non-GNU makes.
Fix warnings compiling in maintainer mode.
Install DB/common.php and DB/mysql.php on "make install".
# We still have a warning from http_config.h:97. Rasmus? :-)
necessary, because we can change the value of INCLUDES globally in one
place (configure.in).
Also add two defines in thread-safe mode
(_REENTRANT and POSIX_PTHREAD_SEMANTICS)
(PHP preg_replace):
Fixed a bug that happened when regex was an array and replacement was a
single non-string value. Also changed conversions to use
convert_to_string_ex().
(PHP preg_grep): use convert_to_string_ex() for proper conversion
with libtool components
* SAPI targets can enable thread-safe mode and define
shared/static/program build target
* all configure scripts use the same config.cache
* phplibdir is $(top_builddir)/modules to avoid
permission problems
* sapi/*/Makefile.inc are gone
* runpath handling cleaned up
* top-level Makefile.in obsoleted through Makefile.am
* --enable-versioning uses libtool's cleaner and more
portable -export-symbols feature
- 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..
-Updated preg_replace() code to handle stuff properly
-Removed ability to specify external PCRE library source to link against
(since our bundled version is patched now)
First of all, as per extensive discussion on the list, the functions are now
prefixed with "preg" instead of "pcre".
Secondly, global matching is now possible using preg_match_all. Please, give
suggestions on a better name if this one doesn't sit well with you. Possible
names are preg_global_match and preg_gmatch.
preg_match_all takes 4 arguments: a regex pattern, a subject string,
the array for capturing subpatterns, and a parameter that tells how the results
in the subpatterns array are arranged.
Basically, preg_match_all will go through the subject string and try to capture
all the matches that it finds, not just the first one like preg_match.
4th parameter can be PREG_PATTERN_ORDER (default) or PREG_SET_ORDER.
Example:
preg_match_all("|</?([^>]+)>|", "<div align=left>a test</div>", $out, PREG_PATTERN_ORDER);
This returns results so that $out[0] is an array of full pattern matches, $out[1] is an array
of first captured subpattern matches, and so on.
$out[0] -> ("<div align=left>", "</div>")
$out[1] -> ("div align=left", "div")
Example:
preg_match_all("|</?([^>]+)>|", "<div align=left>a test</div>", $out, PREG_SET_ORDER);
This returns results so that $out[0] is an array of first full pattern match and subpatterns,
$out[1] is an array of second full pattern match and subpatterns.
$out[0] -> ("<div align=left>", "div align=left")
$out[1] -> ("</div>", "div")
If anyone has a better name for these PREG_ constants and also which one should be the default,
I'd like to hear it.
PCRE library can be found at ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/
config.m4 will be updated to be more robust later on.
perl_match() takes a regular expression, the source string, and the array
for subpattern matches.
perl_replace() takes a regular expression, the search string, and the replacement
string.
Regular expression is specified using delimiters and options. Example:
perl_match("/<[a-z]*>/i", $text, $tags);
More stuff is coming soon.