Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ashammari's avatar

PHP error when modifying an input name to name[]

from the login page , inspect the input email and change it to email[]. and submit a request, php error will happen and Laravel will catch that and say "Whoops".

I'm pretty sure many of you now that , but I'm just wondering is that error handler is the best way to handle this type of php error? do we need extra checking for every input to make sure it's "a string but not an array"?

What do you think?

0 likes
2 replies
chrisgeary92's avatar

I guess it depends what error is actually thrown. It's going to be some kind of exception so you could just use Laravel to present a pretty page using this: http://laravel.com/docs/4.2/errors#handling-errors

But to be honest, if someone is going to go and modify your source code to try and break it, they deserve to be presented with a useless screen.

But yes, perhaps Jeffery should setup a catch all, generic error page?

1 like
bashy's avatar

Since it wouldn't normally happen without someone editing the inputs or data sent, I don't think it's much to worry about unless you want to account for every type of data someone will try and send (API etc).

1 like

Please or to participate in this conversation.