Problem
I have an issue on a rather large platform where users can enter data that contains spaces at the beginning and at the end of the input. This causes issues. I know that I can modify the JavaScript validation, but this website has a tremendous amount of pages and forms. Finding and changing each occurrence would be a nightmare.
Workaround
Since all the forms and pages share index.php, I thought of the idea of intercepting the request/get/post variables before any controller/routing processing is handled by the platform.
Note: I am aware that this is an extremely cheap way of going about it. But actions must be taken immediately until I can at least work on doing it the right way. This is functioning perfectly as it is. I just have a couple concerns.
$_REQUEST = array_map('trim',$_REQUEST);
$_GET = array_map('trim',$_GET);
$_POST = array_map('trim',$_POST);
Conerns
Are there any actual legitimate scenarios where this code would error on?
Is there a major performance hit?
Are there any security flaws?
Are there risks of data integrity being sabotaged with trim()?