Commit graph

50 commits

Author SHA1 Message Date
Andrew Garrett d4d2f4913d Patch by Robert Rohde to prevent empty-string matches of a regex intended to match numbers 2009-03-26 01:30:05 +00:00
Andrew Garrett 20f8b1d16b Properly fix regex munging 2009-03-25 12:43:53 +00:00
Andrew Garrett 1bb05bb402 Fix regex munging by not breaking with regexes with already-escaped /s 2009-03-25 12:15:28 +00:00
Andrew Garrett 5e70316a3a Faster brace short-circuit in Abuse Filter Parser. Patch by Robert Rohde. 2009-03-25 11:48:33 +00:00
Andrew Garrett 86e4081206 Abuse Filter Parser:
* Efficiency -- use /A instead of PREG_OFFSET_CAPTURE and comparing offsets.
* Expand error messages to enhance debugging.
* General code quality
2009-03-25 11:36:38 +00:00
Andrew Garrett fa2ef6a6ca Revert half-done patch from r48802 2009-03-25 10:57:46 +00:00
Andrew Garrett 91d501a4e0 Remove OBSOLETE file for PasswordReset 2009-03-25 10:55:43 +00:00
Andrew Garrett cf6f2899f6 Follow-up to r48674. 2009-03-22 10:34:54 +00:00
Andrew Garrett de32554f33 Fix remote execution vulnerability (exploitable only by admins) 2009-03-22 10:31:26 +00:00
Andrew Garrett 2495c5fcf7 Optimise rmdoubles by replacing its entire code with a single regex. Benchmarking shows it's up to 20 times faster. 2009-03-22 02:39:34 +00:00
Andrew Garrett 12f62fdea4 Fix another annoying bug 2009-03-19 00:18:03 +00:00
Andrew Garrett 33a83c67a2 Some fixes for r48545 2009-03-19 00:07:29 +00:00
Andrew Garrett e2ad3830a0 New short-circuiting of expensive operations when a boolean op means that the result won't matter 2009-03-18 23:28:35 +00:00
Andrew Garrett 1f4f45f8f2 Again revert accidentally-committed half-done code 2009-03-16 08:24:20 +00:00
Andrew Garrett 334582b645 Fix weird bug occurring in corrupted databases. 2009-03-16 08:21:24 +00:00
Andrew Garrett a8a4d7fc5a Revert half-done code introduced in r48372 2009-03-13 08:11:43 +00:00
Andrew Garrett 0e070fac7f Fix problems with prevention of double warnings 2009-03-13 08:02:05 +00:00
Andrew Garrett 864a73e907 New ip_in_range function 2009-03-09 12:39:52 +00:00
Andrew Garrett 5983a65415 Change escaping handling -- make \d => \d instead of d. It helps with writing regexes. 2009-03-07 01:31:35 +00:00
Andrew Garrett 55b417f517 Add rcount function, same as count except it takes a regex as the needle 2009-03-07 01:26:42 +00:00
Andrew Garrett e60dee6cac Add an interface for extensions to add variables into the variable list (only for ones generated for filtering, for now). Includes an implementation in the TorBlock extension 2009-03-05 02:43:05 +00:00
Andrew Garrett 92698e95ba Improve AbuseFilter performance by implementing lazy initialisation of computed variables.
This has been done by replacing simple associative arrays with an AbuseFilterVariableHolder, which recognises helper classes called AFComputedVariables.
Computation may occur during the abuse filter analysis, or later when testing and reviewing filters.
2009-02-26 12:15:14 +00:00
Andrew Garrett 05ea5b783d Add rmwhitespace function 2009-02-18 19:42:01 +00:00
Andrew Garrett 32d676942d Remove remnants of ctype_, and replace them with appropriate regexes (which, while slower, are locale-safe). 2009-02-11 20:01:00 +00:00
Andrew Garrett 35e61feeb6 Abuse Filter Parser updates
* Deprecate parseTokens in favour of a parse-as-you-go approach, faster and uses less memory.
* Display variables in lower_case so they aren't SHOUTING_AT_PEOPLE.
* Tell people if they try to use variables that don't exist, rather than silently returning NULL.
2009-02-11 20:00:33 +00:00
Andrew Garrett 0880f444b1 Abuse Filter Parser updates:
* Use strcspn to scan ahead for long regions of uninteresting text in string handling (performance).
* Remove cruft specific to my system in phpTest.php.
* Remove a test that was in incorrect syntax, and useless without adding variable support.
2009-02-11 18:23:21 +00:00
Andrew Garrett bfe57be65d Rewrite of Abuse Filter parser tokeniser.
I've made it more performant and fixed a few bugs by using regexes
instead of PHP loops, where possible, under the assumption that the
PCRE parser is more efficient than the same thing implemented in pure PHP.
Also, I'm now passing the same string around and calculating offsets, which
Tim tells me is far more performant than continually truncating the same string.

All tests still pass, with the exception of string.t, which I've modified
to remove the offending code, which never worked.
2009-02-11 01:41:51 +00:00
Andrew Garrett 430c95a60d Make variable names and keywords case-insensitive. 2009-01-30 23:46:25 +00:00
Andrew Garrett 48748d8fa7 Fix use of instance methods in nextToken, which is a static method. 2009-01-27 04:09:53 +00:00
Andrew Garrett 11ab345814 Localise Abuse Filter exceptions. 2009-01-26 23:32:46 +00:00
Andrew Garrett d50a26f04d Explicit detection for division by zero. 2009-01-25 05:54:49 +00:00
Andrew Garrett 2d1056858d Fix up error message. 2009-01-25 05:41:58 +00:00
Andrew Garrett 7c210e7849 Typo 2009-01-25 05:34:27 +00:00
Andrew Garrett 7872822e86 Fix weird method of checking if any MulRel operations worked. 2009-01-25 05:25:33 +00:00
Andrew Garrett f3015ff2fd Fix notice in a corner case. 2009-01-23 23:59:42 +00:00
Andrew Garrett 53179c675f Apply changes from change-tagging branch. I will remove all of the stuff actually related to change tagging in a moment, to avoid trunk changes on Wikimedia sites. 2009-01-23 19:23:19 +00:00
Andrew Garrett d5b58edfbb Windows compatibility with PHP parser, fnmatch() function. 2008-10-27 02:24:35 +00:00
Andrew Garrett d0972206f3 Add forgotten rmspecials to funcNorm in PHP parser 2008-09-22 14:03:45 +00:00
Andrew Garrett 308867d25c Fix count function 2008-09-18 14:27:26 +00:00
Andrew Garrett 4fd43cdea9 Add basic functionality to delete filters (not really a deletion, just moved to another list) 2008-09-05 14:27:18 +00:00
Victor Vasiliev c8ea521424 PHP parser:
* Fix some notices
* Add if-then-else and ternary operator
* Fix ordering of operators
* Skip whitespace.t till test runner will be fixed
* Still lacks dates and correct Unicode string handling
2008-08-31 15:12:55 +00:00
Andrew Garrett 1f7effdd19 Fix a notice 2008-08-31 08:05:33 +00:00
Andrew Garrett fc0b18e2d6 PHP Parser:
* Re-add, per Brion's request.
* Add an easy PHP tester, to run the tests used for the native parser.
* Update to pass 20 tests out of 27. Still to go:
** Implement dates.
** Fix order of operations.
** Fix backslash parsing.
** Implement if-then-else and ternery operator.
2008-08-31 05:56:49 +00:00
Andrew Garrett fa02666551 Remove PHP parser. It's totally inconsistent with the native parser now, and updating it wouldn't really be worth it (seeing as the native one would be used on Wikimedia) 2008-08-16 07:41:46 +00:00
Andrew Garrett 016da694a6 Abuse Filter:
* Reimplement tools, starting with a spiffy AJAX expression tester. Didn't bother implementing as non-AJAX, as it's just an extra.
* Change exchange protocol between native parser and PHP app. Resulted in 2-3-fold performance boost.
* Fix minor bug from last night.
2008-08-04 14:27:48 +00:00
Brion Vibber ea40085dc8 fix parse error, stray executable bit 2008-08-04 05:33:06 +00:00
Andrew Garrett 529d7b4277 Abuse Filter:
* Introduce a syntax check on-save.
* Introduce filter history (requires DB schema change).
* Deprecate now non-working /tools interface (will come back).
2008-08-03 14:04:26 +00:00
Andrew Garrett cb65839e40 Fix more deprecated pass-by-reference syntax 2008-08-02 13:51:29 +00:00
Andrew Garrett d5ec855d5b Fix some erroneous deprecated pass-by-reference syntax 2008-08-02 13:45:08 +00:00
Andrew Garrett b283904b81 AbuseFilter native parser:
* Revert r38187 for now:
** Introduced a memory leak.
** Used an unnecessary library. The point is taken, and this will be fixed in a few days (using glibc instead).
* Fix logic error in boolean ops.
* Integrate with the PHP abuse filter using AbuseFilterParserNative class.
* Fix memory leak.
* Fix a few miscellaneous bugs
2008-07-31 16:28:24 +00:00