Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9140237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:29:23+00:00 2026-06-17T09:29:23+00:00

while following this bit of code $f3=require(‘lib/base.php’); $f3->route(‘GET /brew/@count’, function($f3) { echo $f3->get(‘PARAMS.count’).’ bottles

  • 0

while following this bit of code

    $f3=require('lib/base.php');

    $f3->route('GET /brew/@count',
        function($f3) {
            echo $f3->get('PARAMS.count').' bottles of beer on the wall.';
        }
    );
    $f3->run();

from Fat-Free Framework examples at https://github.com/bcosca/fatfree#routing-engine I get this error in my browser:

    Internal Server Error

    Missing argument 1 for {closure}()

    * /var/www/f3/index.php:36 Base->{closure}
    * /var/www/f3/lib/base.php:972         
    * Base->call(Closure::__set_state(),NULL,'beforeroute,afterroute')
    * /var/www/f3/index.php:40 Base->run()

I know the problem is that $f3 is not passed to function as parameter but i don’t understand why. Can anybody help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:29:24+00:00Added an answer on June 17, 2026 at 9:29 am

    I just the same situation! I was using version 3.0.1 from SourceForge. I tried the following, which worked, but created other issues:

    $f3=require('lib/base.php');
    
    $f3->route('GET /brew/@count',
        function() use ($f3) {
            echo $f3->get('PARAMS.count').' bottles of beer on the wall.';
        }
    );
    $f3->run();
    

    The use clause (which isn’t very well documented in php) allows you to use variables from the parent scope from an anonymous function. Read more here: Closure vs Anonymous function (difference?)

    Try upgrading the F3 core to the latest release. One of the developers recommended to upgrade to the 3.0.2 release from here: https://github.com/bcosca/fatfree. It was a very quick fix!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While I am running this code it showing me a following error:- Column 'virtuemart_product_id'
I have the following code: Bear in mind that while this code works on
I get an exception while executing following piece of code bool FieldValueMessage::Get(const std::string &field,
so I have the following bit of code: while((line = reader.readLine()) != null) {
While reading the web2py manual, I came across this following: 'Once a new user
I am getting Following Exception while configuring the Connection Pool in Tomcat This is
While following path for wait system call, noticed that before calling do_wait_thread we get
I have the following bit of code: // Loop through returned data and write
I've been using the following bit of code for years to consume characters from
Why does the following bit of code work in C: int res = pow(2,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.