[pmwiki-users] substr markup breaks with httpvariables

Peter Bowers pbowers at pobox.com
Fri Feb 5 13:24:39 CST 2010


On Thu, Feb 4, 2010 at 8:59 PM, edwin marte <edwin.marte at leidba.com> wrote:
> Ok, I found that the result {Dec   is coming from my tests. The Group I am
> using is named Decisiones (spanish) so the problem is that substr in not
> evaluating {Test.{$?page}$:date} . is only  seeing the  expression as Plain
> Text ( it should be {Tes for our porpuses.)
>
> Anyway or ideas on making substr evaluate correctly ?

This is a problem with httpvariables that has been reported before
(multiple times, I believe?) on this list with suggested fixes.

http://www.mail-archive.com/pmwiki-users@pmichaud.com/msg12611.html
http://www.mail-archive.com/pmwiki-users@pmichaud.com/msg12610.html

Basically the GET variables are supposed to be interpolated once
before PTVs and once after.  But because of the name of the markup
(simple typo) it only gets evaluated *after* PTVs and thus
{Test.0001$:date} cannot be interpolated.

If you want to fix it, here's what to change in httpvariables.php:

Note these 2 Markup calls are almost identical.  Specifically the
*name* of the markup (the first argument) is identical  -
'{$?!|@~var}

This (having the same name for 2 rules) doesn't work as expected.

===(snip)===
# {$?!|@~var} http variable substitutions before {$var}
Markup('{$?|!@~var}', '<{$var}',
  '/\\{\\$([\\?\\!\\|@~])(\\w+)\\}/e',
  "HttpVariables(\$pagename, PSS('$1'), PSS('$2'))");

# {$?!|@~var} http variable substitutions after {$var}
Markup('{$?|!@~var}', '>{$var}',
  '/\\{\\$([\\?\\!\\|@~])(\\w+)\\}/e',
  "HttpVariables(\$pagename, PSS('$1'), PSS('$2'))");
===(snip)===

Change one of the names in your copy of httpvariables -- just add an
"x" to the end of one of them (doesn't matter what the change is or
which one is changed -- just make sure it doesn't step on the name of
another rule...)

I think that will solve your problem and leave you without having to
use the custom action...

-Peter



More information about the pmwiki-users mailing list