Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Fuel\Core\PhpErrorException [ Fatal Error ]: Input truncated by PHP
  • My company use FuelPHP and MySQL. it works fine. and now it need to develop another app using the same database.
    so I try to built it using same FuelPHP.

    I Try to install FuelPHP in virtual host. My fisrt app works fine. The second app can show login  page correctly. But when I try to login, it shows an error message "
    Fuel\Core\PhpErrorException [ Fatal Error ]:
    Input truncated by PHP. Number of variables exceeded . To increase the limit to at least the 2 needed for this HTTP request, change the value of "max_input_vars" in php.ini.


    I never found this error message when developing 2nd app. so How can I fix this?

    thanks for your advice
  • Do what the message says.

    It says that your php.ini has a max_input_vars defined (the maximum number of variables in a POST), and your post request contains 2 variables more than the defined maximum limit. 

    So either reduce the size of your form, or increase the max_input_vars value (see http://php.net/manual/en/info.configuration.php#ini.max-input-vars)

    This is a check that has been added to 1.9/develop recently. It turned out that although the docs state that a limit is applied and an E_WARNING is issued if the limit is exceeded, certain PHP versions don't throw this warning, but silently truncate your input, which could cause errors in your application because not all form variables are passed on to your application in a POST.
  • I tried to edit max_input_vars in php.ini, but my php.ini doesn't have this parameter. 
    SO I try to add this parameter to php.ini and restart php , 
    or set in .htaccess but still produce the same error message.

    at first here is my folder structure
    /fuel    --first app.. and at the index.php pointing to this location
       -app
       -core
       -package

    /fuelrsa   --second app.. and at the index.php pointing to this location
       -app
       -core
       -package


    so just curious.., I changed the folder structure to 
    /fuel    
       -app      -- index.php  APPATH in the first app pointing to this location
       -apprsa    -- index.php  APPATH in the second app pointing to this location
       -core
       -package

    and it works....., but I'm not sure is this the correct way or not.. :)
    Tq for ny suggestion

  • Doesn't really matter, the only difference is that after your change, both apps share the same /public, and they share the same fuel codebase.

    We something like this:
    /fuel
        /core
        /modules
        /packages
    /app1
        /app
        /modules
        /packages
        /public
    /app2
        /app
        /modules
        /packages
        /public

    so every app has it's own public folder and public assets, and modules and packages can be both global/shared or defined per application.

    However, this doesn't have anything to do with the error message, which is related to the number of input fields in a form. And the default for max_input_vars is 1000, so you must have very large forms to get this error.

    The default php.ini contains:
    ; How many GET/POST/COOKIE input variables may be accepted
    ; max_input_vars = 1000

  • However, this doesn't have anything to do with the error message, which is related to the number of input fields in a form.

    I Got the error with login page.., so it means only 2 variables...., username and password

    I still don't know what makes the error.., but as long as the app works.., it's fine..., 
    tQ :)

  • Very weird.

    If you have only two form fields, and the error message says you need at least two more, it suggests that ini_get('max_input_vars') returns zero (or something that evaluates to zero).

    Can you var_dump(ini_get('max_input_vars')) in your index.php for me, and let me know what the exact result is? And also, what PHP version you exactly use?

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion