The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Route middleware function error

Greg Olone's Avatar

Greg Olone

30 Aug, 2015 11:41 PM

Slim 2.6.1
PHP 5.4.14

I'm getting an error back from Slim when calling a route with a piece of middleware specified. The error is:

"Fatal error: Function name must be a string in /home/website/xojo/www/feedback/api/v2/routes/builds.php on line 42"

For simplicity, I've trimmed down my closure to:

$requiresRole = function ( $roles = 'member' ) {
    return function () use ( $roles ) {


My route is elsewhere in the program. This is line 42 (as referenced in the error above)

$app->put('/:id', $requiresRole('bot','engineer'), function ($id) use ($app) {


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac