SV: SV: [phplib] IntegratedTemplate and case-sensitivity From: Martin Larsen (mrl <email protected>)
Date: 12/15/00

Ulf Wender wrote:

>> The class uses preg_match_all() and preg_replace, but the regular
expression
>> looks something like this:
>> @{([0-9A-Za-z_-]+)} <email protected>
>>
>> Should this be changed to:
>> @{([0-9a-z_-]+)] <email protected> or how?

> Replace all  <email protected> with  <email protected> and check if all preg_* functions use the new
> modifier.

Hmm... After taking a closer look at the code it seems it's a little more
tedious as so. You have this piece of code in your class
(integratedtemplate.inc v1.9 line 414):

foreach ($this->blockvariables[$block] as $allowedvar => $v) {
        if (isset($this->variableCache[$allowedvar])) {
                 $regs[] = "@".$this->openingDelimiter . $allowedvar .
$this->closingDelimiter . " <email protected>";
                $values[] = $this->variableCache[$allowedvar];
                unset($this->variableCache[$allowedvar]);
        }
}

This piece of code is not "case-insensitive-compatible" as the
"isset"-statement returns false if $allowedvar is in a different case as the
placeholdername found in the template-file.

So it seems it might be easier to convert all the placeholdernames in the
templatefile and all the variables given by the script to lowercase and do a
normal case-sensitive search.

It would also make it easier to have a setting which enables the user to
choose if he wants a case-sensitive or case-insensitive search as one didn't
have to change the RegExp.

Best regards,
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>