The problem is that this statement is invalid:
echo ();
It will cause parsing errors. So you need to inject something to avoid this error. For example:
$var = "1); phpinfo(); echo (1"; eval("echo ($var);");
When you use that input, the result of substituting the variable is:
eval("echo ($a='1');phpinfo();echo($a);");
So $a='1'
is assigned here, and the result of the assignment is output (that is, the value assigned to $a
). Then phpinfo()
was executed. Finally $a
is output again.
If you try to use );phpinfo();echo(
, it won't work because it's trying to do echo ()
. But echo
At least one parameter is required.
So to inject code here, you have to make sure the input starts with something valid after echo (
) and ends with something valid before );
. Place any additional code you want to inject between these two parts.