@annonimus

Как исправить ошибку 500 в Laravel?

Всем доброго времени суток!
Ребят, после обновления скрипта, вылезла ошибка 500, APP_DEBUG на true переключаю, ничего не показывает, в логи (storage/logs/laravel.log) залез, выдает следующую ошибку..
[2019-08-25 22:49:43] production.ERROR: Dotenv\Exception\InvalidFileException: Dotenv values containing spaces must be surrounded by quotes. in /home/admin/web/site.com/public_html/vendor/$
Stack trace:
#0 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Parser.php(43): Dotenv\Parser::parseUnquotedValue('Lato, Helvetica...')
#1 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Loader.php(237): Dotenv\Parser::parseValue('Lato, Helvetica...')
#2 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Loader.php(151): Dotenv\Loader->sanitiseVariableValue('CONF_sitefontfa...', 'Lato, Helvetica...')
#3 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Loader.php(128): Dotenv\Loader->processFilters('CONF_sitefontfa...', 'Lato, Helvetica...')
#4 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Loader.php(323): Dotenv\Loader->normaliseEnvironmentVariable('CONF_sitefontfa...', NULL)
#5 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Loader.php(89): Dotenv\Loader->setEnvironmentVariable('CONF_sitefontfa...')
#6 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Dotenv.php(114): Dotenv\Loader->load()
#7 /home/admin/web/site.com/public_html/vendor/vlucas/phpdotenv/src/Dotenv.php(52): Dotenv\Dotenv->loadData()
#8 /home/admin/web/site.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/LoadEnvironmentVariables.php(27): Dotenv\Dotenv->load()
#9 /home/admin/web/site.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(208): Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables->bootstrap(Object($
#10 /home/admin/web/site.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(162): Illuminate\Foundation\Application->bootstrapWith(Array)
#11 /home/admin/web/site.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(146): Illuminate\Foundation\Http\Kernel->bootstrap()
#12 /home/admin/web/site.com/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illumin$
#13 /home/admin/web/site.com/public_html/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#14 {main}


Как я понял нужно поставить кавычки в файлах, не можете показать на примере этого файла Parser.php что я должен сделать в 43 строке?..

Parser.php
<?php

namespace Dotenv;

use Dotenv\Exception\InvalidFileException;

class Parser
{
    const INITIAL_STATE = 0;
    const QUOTED_STATE = 1;
    const ESCAPE_STATE = 2;
    const WHITESPACE_STATE = 3;
    const COMMENT_STATE = 4;

    /**
     * Parse the given variable name.
     *
     * @param string $name
     *
     * @return string
     */
    public static function parseName($name)
    {
        return trim(str_replace(array('export ', '\'', '"'), '', $name));
    }

    /**
     * Parse the given variable value.
     *
     * @param string $value
     *
     * @throws \Dotenv\Exception\InvalidFileException
     *
     * @return string
     */
    public static function parseValue($value)
    {
        if ($value === '') {
            return '';
        } elseif ($value[0] === '"' || $value[0] === '\'') {
            return Parser::parseQuotedValue($value);
        } else {
            return Parser::parseUnquotedValue($value);
        }
    }

    /**
     * Parse the given quoted value.
     *
     * @param string $value
     *
     * @throws \Dotenv\Exception\InvalidFileException
     *
     * @return string
     */
    public static function parseQuotedValue($value)
    {
        $data = array_reduce(str_split($value), function ($data, $char) use ($value) {
            switch ($data[1]) {
                case Parser::INITIAL_STATE:
                    if ($char === '"' || $char === '\'') {
                        return array($data[0], Parser::QUOTED_STATE);
                    } else {
                        throw new InvalidFileException(
                            'Expected the value to start with a quote.'
                        );
                    }
                case Parser::QUOTED_STATE:
                    if ($char === $value[0]) {
                        return array($data[0], Parser::WHITESPACE_STATE);
                    } elseif ($char === '\\') {
                        return array($data[0], Parser::ESCAPE_STATE);
                    } else {
                        return array($data[0].$char, Parser::QUOTED_STATE);
                    }
                case Parser::ESCAPE_STATE:
                    if ($char === $value[0] || $char === '\\') {
                        return array($data[0].$char, Parser::QUOTED_STATE);
                    } else {
                        return array($data[0].'\\'.$char, Parser::QUOTED_STATE);
                    }
                case Parser::WHITESPACE_STATE:
                    if ($char === '#') {
                        return array($data[0], Parser::COMMENT_STATE);
                    } elseif (!ctype_space($char)) {
                        throw new InvalidFileException(
                            'Dotenv values containing spaces must be surrounded by quotes.'
                        );
                    } else {
                        return array($data[0], Parser::WHITESPACE_STATE);
                    }
                case Parser::COMMENT_STATE:
                    return array($data[0], Parser::COMMENT_STATE);
            }
        }, array('', Parser::INITIAL_STATE));

        return trim($data[0]);
    }

    /**
     * Parse the given unquoted value.
     *
     * @param string $value
     *
     * @throws \Dotenv\Exception\InvalidFileException
     *
     * @return string
     */
    public static function parseUnquotedValue($value)
    {
        $parts = explode(' #', $value, 2);
        $value = trim($parts[0]);

        // Unquoted values cannot contain whitespace
        if (preg_match('/\s+/', $value) > 0) {
            // Check if value is a comment (usually triggered when empty value with comment)
            if (preg_match('/^#/', $value) > 0) {
                $value = '';
            } else {
                throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.');
            }
        }

        return trim($value);
    }
}


Спасибо!
  • Вопрос задан
  • 1888 просмотров
Решения вопроса 1
DevMan
@DevMan
открываете env-файл(ы) и любые параметры с пробелами берете в кавычки.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы