Page MenuHomePhabricator

string.gsub( s, "%%1", repl) fails as "invalid capture index"
Closed, InvalidPublic

Description

When I use:

  • text = string.gsub(text, "%%1", (v1 or "*") )

That fails as "invalid capture index"

Following my each day survey of MW version, the version where the bug appeared is
Mediawiki-Wikisource 1.29.0-wmf.3 (c1e59aa)-UTC-20161123-18:55
which I seen at 20161124-22:36 French time

To continue my work, I repair it using:
local j = string.find(text, "%", 1, true)
local k = string.find(text, "1", 1, true)
if j and k and ( j + 1 == k ) then
form = string.sub(form, 1, j-1) .. tostring(val) .. string.sub(form, k+1)
else
form = string.gsub(form or "gsub", "%%" .. S9, tostring(val) )
end

Event Timeline

Rical created this task.Nov 27 2016, 12:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 27 2016, 12:46 PM
Anomie added a subscriber: Anomie.Nov 28 2016, 12:14 AM

Please supply a full test case that illustrates the problem. Ideally something closer to 10 lines than a link to a complex 1000-line module.

I test but not detect an error ?
That come probably from a missing "rep = nil" somewhere in Module:Central.
I tested there.

Sorry for this false alert !

Anomie closed this task as Invalid.Nov 28 2016, 2:58 PM
Rical removed a subscriber: Rical.Jul 21 2017, 9:52 AM