skip to Main Content

I have the following error in laravel, it is intermittent

local.ERROR: Illegal length modifier specified 'f' in s[np]printf call {"exception":"[object] (Symfony\Component\Debug\Exception\FatalErrorException(code: 1): Illegal length modifier specified 'f' in s[np]printf call at /home/usuario/public_html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122)
[stacktrace]
#0 {main}

The error I receive only in my hosting in localhost everything is fine.

Trying to resolve this error I go to the file that says the exception vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122

And I see this Code:

/**
     * Write the contents of a file.
     *
     * @param  string  $path
     * @param  string  $contents
     * @param  bool  $lock
     * @return int|bool
     */
    public function put($path, $contents, $lock = false)
    {
        return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
    }

Said function is from laravel but I don’t see any problem in it.

I have PHP 7.4 hosting and I use the version of laravel 5.8 in this project

How could I solve it?

I already did all the steps of

php artisan clear;  
php artisan view:clear;  
php artisan config:cache;

Nothing works. Anyone have any idea why this happens ???

Grades:

I updated my version of laravel from 5.8 to version 6.0 without any success the problem persists, I don’t know why it does it.

2

Answers


  1. Try to delete vendor folder then run composer install

    Login or Signup to reply.
  2. I had the same issue in hosting server. In my localhost the PHP version was 8 and the default in hosting 7.4. I changed it to version 8 and the problem was fixed!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search