Commit Graph

2145 Commits

Author SHA1 Message Date
Andrey Hristov
0062ae6218 A few changes here.
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.
1999-05-26 15:22:02 +00:00
Zeev Suraski
033858e13d Avoid crashing if an error occurs before we open the first file. 1999-05-25 22:55:13 +00:00
Zeev Suraski
cf58b7ef16 Add container for file-upload. It's not quite implemented yet. 1999-05-25 22:28:24 +00:00
Andrey Hristov
6155d91e7a Just a little sanity check. 1999-05-25 21:47:58 +00:00
Zeev Suraski
4f545f9c6b Allow unregistering content types as well. 1999-05-25 21:19:46 +00:00
Zeev Suraski
72f6e823f9 * Add generic POST content-type support. Only application/x-www-form-urlencoded
supported at this time, but the framework allows for any other types, including
  runtime addition of types.
1999-05-25 21:14:54 +00:00
Zeev Suraski
7b98592282 include regex in Win32 build 1999-05-24 18:02:42 +00:00
Zeev Suraski
e115fdc6d6 The last fix was wrong 1999-05-24 16:48:01 +00:00
Zeev Suraski
cbcd462d46 Another operators fix 1999-05-24 16:43:47 +00:00
Zeev Suraski
97107dc440 boolean comparison didn't work with smaller-than and greater-than, something that
fucked up berber's site a bit.  fixed.
1999-05-23 22:07:04 +00:00
Zeev Suraski
0eb500cef5 Thou shalt use the API, and thou shalt be safe 1999-05-23 20:32:19 +00:00
Andrey Hristov
57b22c8b64 Some comments. 1999-05-22 19:46:27 +00:00
Sascha Schumann
3165710b77 - add -lregex
- change module name to php4
1999-05-22 19:41:28 +00:00
Andrey Hristov
912f17d278 Added ability to pass array parameters to pcre_replace. 1999-05-22 19:14:57 +00:00
Zeev Suraski
ee7032f069 Sigh, another leak bites the dust. FREE_OP missing in case of a SEND_VAR. 1999-05-22 18:02:30 +00:00
Zeev Suraski
84bb91d762 I'm on a roll. Fix a nasty yet stupid AiCount bug 1999-05-22 17:30:09 +00:00
Zeev Suraski
05f6cf54f0 Warn about AiCount not zeroing out 1999-05-22 16:48:23 +00:00
Sascha Schumann
7b58930456 add a $(srcdir) 1999-05-22 16:13:10 +00:00
Sascha Schumann
13c3c4012e fix compile issues in LDAP/XML exts 1999-05-22 16:12:09 +00:00
Zeev Suraski
1250c43a39 * Add struct name to all typedef's so that they can be debugged with MSVC
* Fix an AiCount bug - list(...) = $var was using $var multiple times, and thus
causing AiCount to be decreased multiple times even though it was increased only
once for $var.  Mark all FETCH_DIM's so that they won't decrease AiCount, and only
decrease AiCount on the last FETCH_DIM.
* Fix a stupid bug - forgot to pass CLS_C to some compiler function.  For some reason
MSVC doesn't report these :I
1999-05-22 16:10:51 +00:00
Sascha Schumann
1652802641 fix APXS compile 1999-05-22 15:48:29 +00:00
Zeev Suraski
d62a739cca More fixes. Should hopefully work well now. 1999-05-22 12:19:57 +00:00
Zeev Suraski
9df57a2263 php_ini fixes 1999-05-22 11:34:21 +00:00
Zeev Suraski
080105f79f Give more information and save log lines in memory leak reports 1999-05-22 11:20:56 +00:00
Zeev Suraski
9b4d71205b * Minor fixes
* Better handling for multiple repeated memory leaks (libzend updated)
1999-05-22 10:56:36 +00:00
Zeev Suraski
a08e3925b1 Time to rename the child 1999-05-22 09:24:21 +00:00
Zeev Suraski
87ba08d1d0 Avoid leaking fd's in case of failures 1999-05-22 02:13:01 +00:00
Zeev Suraski
58a0ae7b35 Small fix 1999-05-22 01:15:25 +00:00
Zeev Suraski
ac94c83867 more fixes 1999-05-22 01:07:50 +00:00
Zeev Suraski
9e862c11ec Fix a memory leak 1999-05-21 23:51:19 +00:00
Zeev Suraski
d56ae4f670 That wasn't supposed to slip in 1999-05-21 23:48:24 +00:00
Zeev Suraski
be8b9778e0 This should be centralized... 1999-05-21 23:25:46 +00:00
Zeev Suraski
9dc0842e58 * Properly handle failed file opens in C++
* Properly handle failed require()'s within libzend
1999-05-21 20:20:32 +00:00
Sascha Schumann
00cb03bd49 add support for mhash 0.5.0
see http://sasweb.de/mhash/
1999-05-21 20:09:23 +00:00
Andrey Hristov
e3a70c1f04 -Added regex cache
-Made module thread-safe
1999-05-21 19:27:44 +00:00
Zeev Suraski
c57c0e9cd5 * Fix error handling startup on the thread-safe CGI version
* A failed require() is a compile-time error, consider it as one
1999-05-21 19:22:17 +00:00
Zeev Suraski
f33c22c055 * Fix the comments issue. yymore() worked like a charm.
* Change all flex states to be prefixed with ST_
1999-05-21 17:31:49 +00:00
Andrey Hristov
be9dc58cfe Get rid of debug printf's. 1999-05-21 13:29:05 +00:00
Andrey Hristov
17bbbf2963 Initial check-in of PCRE (Perl Compatible Regular Expressions) extension.
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.
1999-05-21 13:17:23 +00:00
Sascha Schumann
b57dc27595 - run ext sources through conv_proto
- add necessary phpext_*_ptr
1999-05-21 10:06:25 +00:00
Sascha Schumann
4fe8fe715e merge in some PHP3 stuff 1999-05-21 08:37:48 +00:00
Sascha Schumann
6f06b11679 incorporate YP/NIS support 1999-05-21 08:29:51 +00:00
Sascha Schumann
fb407676a2 - fix compile issues for various packages (dbase, sysv*, zlib)
- some cleanup in mhash/mcrypt
1999-05-21 08:20:13 +00:00
Sascha Schumann
0fe7fe30b5 - add phpext_pgsql_ptr
- semaphore update for glibc-2.1 systems
1999-05-21 08:04:38 +00:00
Sascha Schumann
672e38da93 Add default path for binary mysql distributions 1999-05-21 07:52:12 +00:00
Sascha Schumann
286fef1ce4 remove debug messages 1999-05-21 07:04:48 +00:00
Zeev Suraski
9cb2cf1393 Optimize allocations into uninitialized_zval assignments 1999-05-20 20:00:59 +00:00
Zeev Suraski
59a539f6ad Use OutputDebugString() or fprintf(stderr,) for memory leaks 1999-05-20 19:06:28 +00:00
Sascha Schumann
27fc61c4dc Apply the fix for feof() 1999-05-20 13:56:19 +00:00
Andi Gutmans
3facf7cb7c - Updates we did today 1999-05-20 13:04:59 +00:00