Web.CGI.Request tries to replace in 0
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=6685
Reported by Piotr Smyrak piotr.smyrak@gmail.com
Attempt to use Web.CGI.Request in a Pike CGI script will fail, when script is supplied with a valid query. Use this code with a query "foo=bar":
void main()
{
Web.CGI.Request req = Web.CGI.Request();
write("Content-type: text/plain\r\n\r\n%O", req->misc);
}
Bad argument 1 to `()(). Expected string.
Unknown program: `()(UNDEFINED)
-:1: _static_modules.Builtin()->single_string_replace()->`()(UNDEFINED)
~/pike/7.8.517/lib/modules/Web.pmod/CGI.pmod/Request.pike:79: Web.CGI.Request()->decode_query()
~/pike/7.8.517/lib/modules/Web.pmod/CGI.pmod/Request.pike:229: Web.CGI.Request()->create()
test.pike:8: /main()->main()
Premature end of script headers: test.pike
The reason being attempt to replace in a rest_query variable that's actually 0;
This line https://github.com/pikelang/Pike/blob/7.8/lib/modules/Web.pmod/CGI.pmod/Request.pike#L79 should be conditional to "if (rest_query)"