fixed Router when data represents a single variable (not an array)

This commit is contained in:
Jonathan Labreuille
2016-04-22 16:59:28 +02:00
parent 1c39d39078
commit d2dbf86a9c

View File

@@ -57,14 +57,16 @@ class Router {
$data = $_POST; $data = $_POST;
} }
// filter out reserved keywords from data if(is_array($data) && !empty($data)) {
$reserved_keywords = array( // filter out reserved keywords from data
'token', $reserved_keywords = array(
'endpoint', 'token',
'method', 'endpoint',
'mailpoet_redirect' 'method',
); 'mailpoet_redirect'
$data = array_diff_key($data, array_flip($reserved_keywords)); );
$data = array_diff_key($data, array_flip($reserved_keywords));
}
try { try {
$endpoint = new $endpoint(); $endpoint = new $endpoint();