Skip to content

Instantly share code, notes, and snippets.

@aronbudinszky
Last active December 21, 2015 10:28
Show Gist options
  • Save aronbudinszky/6291789 to your computer and use it in GitHub Desktop.
Save aronbudinszky/6291789 to your computer and use it in GitHub Desktop.
A quick way to sanitise GET, POST, and REQUEST parameters while Facebook fixes the "slash bug": https://developers.facebook.com/bugs/567466826646137?browse=external_tasks_search_results_521473ef5f0e92913307282
/**
* Temporary GLOBAL Facebook fix for appended slash.
* - Keep in mind that this can have side-effects if you have any data where you ACTUALLY use / at the end.
* - Place this at the beginning of your code, preferably in a file that all of your apps include.
**/
foreach($_REQUEST as $key=>$val) $_REQUEST[$key] = rtrim($val, '/');
foreach($_GET as $key=>$val) $_GET[$key] = rtrim($val, '/');
foreach($_POST as $key=>$val) $_POST[$key] = rtrim($val, '/');
/**
* Temporary specific Facebook fix for appended slash.
* - This is much safer than the above, but may require modification in several places.
**/
$_GET['a_specific_key'] = rtrim($_GET['a_specific_key'], '/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment