Ticket #18 (closed bug: implemented)

Opened 2 months ago

Last modified 2 months ago

escapex() misinterprets commas

Reported by: cary Owned by:
Priority: normal Milestone: 3.9.1 alpha 1
Component: rhostmush Version: 3.9.1 alpha
Severity: bug Keywords:
Cc:

Description

escapex() counts commas as argument separaters but should only do this for the last comma.

The example in the help:

> say escapex(Hey, Sneak a peak at Wiz's desc... [get($1/desc)],\[\])
You say "\Hey \,Sneak a peek at Wiz's desc... [get\(#1/desc\)]"

actually produces:

say escapex(Hey, Sneak a peak at Wiz's desc... [get($1/desc)],\[\])
You say "#-1 FUNCTION (ESCAPEX) EXPECTS 1 OR 2 ARGUMENTS [RECEIVED 3]"

Change History

Changed 2 months ago by cary

securex() has the same problem.

Changed 2 months ago by Ashen-Shugar

  • status changed from new to closed
  • resolution set to implemented

This is a documentation problem and not a script problem.

The issue is because the function takes multiple arguments (unlike escape/secure) it has to acknowledge commas as valid seperators for arguments.

The documentation will be changed to show escaping out the comma in the example.

Changed 2 months ago by cary

Well, if I have to escape the commas already, then this function is of pretty limited usefulness. If the string is arbitrary user input, then I'd have to call escape() anyhow to escape the commas, which of course escapes everything.

What about swapping the order of the arguments? Then everything after the first comma could be treated as the second argument. (I suppose you'd really have to make a new version or a config parameter to set the order of the arguments.)

Note: See TracTickets for help on using tickets.