Hi

After installing and activating the GeSHi filter I get

warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier '|'

in geshifilter.module on line 1019.
in geshifilter.module on line 1096.

all over the place when testing code highlighting =(

Any idea why this happens? I can't imagine '|' being an invalid regexp in certain php versions?

CommentFileSizeAuthor
#4 geshifilter_208720_tagchars_4.patch1.33 KBsoxofaan

Comments

account-deletion-needed’s picture

Ok I nailed down the problem =)

If you use special characters for custom language tags it may mess up the regexp code
because apparently the special characters aren't escaped with a \

For instance the # in [c#] would abruptly end a regexp and cause errors.

soxofaan’s picture

Title: warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier '|' » custom language tags can't contain special characters

updated title

soxofaan’s picture

Title: custom language tags can't contain special characters » prevent custom language tags to contain special characters

Extra validation of custom language tags is needed.

For example, custom language tags should:

  • not contain regular expression special characters like '#', '+', '|' and such
  • not equal reserved some not yet defined GeSHi filter specific keywords (e.g. code, blockcode, questionmarkphp, ...)
  • not equal the generic code tags
  • not equal each other
soxofaan’s picture

Title: prevent custom language tags to contain special characters » check custom language tags for contain special characters
Version: 5.x-2.3 » 5.x-2.x-dev
Status: Active » Needs work
StatusFileSize
new1.33 KB

This is a first version of a patch that should solve the initial problem from #1.
Custom language tags like [c++] and [c#] should work now.

TODO: better validation of custom language tags (see #3)

soxofaan’s picture

Assigned: Unassigned » soxofaan
Status: Needs work » Active

committed patch #4: http://drupal.org/cvs?commit=96150, http://drupal.org/cvs?commit=96151

still todo: better validation of custom tags (see #3)

soxofaan’s picture

Category: bug » feature
soxofaan’s picture

Status: Active » Patch (to be ported)

fixed in HEAD (for Drupal 6) by http://drupal.org/cvs?commit=113423 (also includes SimpleTest test)

soxofaan’s picture

Status: Patch (to be ported) » Fixed

fixed in DRUPAL-5--2 by http://drupal.org/cvs?commit=118057

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.