2
\$\begingroup\$

With PHP, GET parameters may be specified as command-line arguments, which is a valid form of input by our rules. However, they must be passed in the form argname=value on the command line, because register_globals is off by default, and we assume a default configuration. After an exchange in the comments of an answer, I'd like to get clarification/consensus on how to score this.

Note that this does not concern the use of $argv parameters.

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

The referred default permitted input formats is talking about $argv. There isn't a default permitted input format of GET parameters, so this question doesn't make sense. If people want to permit GET parameters as an input format, either directly or via command lines, it's up to them to address the issue of scoring as part of their special case.

\$\endgroup\$
5
  • \$\begingroup\$ I don't agree with this. GET parameters can be passed on the command line just like $argv parameters. The only difference is the syntax and where the input ends up (a named parameter, rather than an entry in $argv). We allow -D in C/C++ entries, why not GET parameters? \$\endgroup\$
    – user45941
    Nov 26, 2015 at 16:10
  • \$\begingroup\$ -D is a compile-time flag. I don't think you're even comparing apples to oranges: you're comparing apples to plaice. \$\endgroup\$ Nov 26, 2015 at 16:41
  • 1
    \$\begingroup\$ It's about end effects, not minutae. You can use -DA=<input> to the same effect as A=<input> in php - the input gets stored in a location that only costs one (or in php's case, two) bytes to access, considerably cheaper than argv[1] or $argv[1], respectively. \$\endgroup\$
    – user45941
    Nov 27, 2015 at 5:27
  • \$\begingroup\$ @Mego, I'm now not sure whether you're arguing in favour of allowing C programs to take their input at compile-time. If you are, that also is not currently supported by any answer to the "Default input methods" question, so if people want to allow it as a special case in answers to their questions then it's up to them to say so and to address any scoring-related issues. \$\endgroup\$ Nov 27, 2015 at 6:49
  • \$\begingroup\$ Oh, I was under the impression that -D was an accepted way of taking input. Disregard my previous statements. \$\endgroup\$
    – user45941
    Nov 27, 2015 at 7:12
2
\$\begingroup\$

Byte penalty equal to the parameter name + 1

Because passing a GET parameter on the command line is a nonstandard command line argument, the parameter must count towards your score. The main question is, how much? Because passing input in the form <program> <input-value> <input-value-2>... is not penalized, I propose that <program> <arg1-name>=<input-value> <arg2-name>=<input-value-2>... should add a byte penalty equal to the sum of the lengths of the argument names, plus an additional byte per parameter for the =.

The only other thing to consider is that they may be passed in via a GET or POST request in the context of a webserver. This is not an acceptable method of input, because we require answers to be self-contained - the answer should be able to run with the input passed via STDIN, function arguments, or any other acceptable form of input, with the specified flags if applicable, without needing external resources other than those specifically allowed in the question, and consistently produce the correct output.

\$\endgroup\$

You must log in to answer this question.