Примечание: неопределенный индекс: args - PullRequest
0 голосов
/ 24 января 2020

Я работаю с Bolt CMS (+ docker - nginx, php74 fpm). Когда у меня появляется ошибка, я получаю что-то подобное:

ContextErrorException в / var / www/vendor/bolt/bolt/src/EventListener/ExceptionListener.php строка 285: Примечание: неопределенный индекс: args

строка 285 в ExceptionListener. php:

$trace[$key]['args_safe'] = $this->getSafeArguments($trace[$key]['args']);

и трассировка:

$trace = $exception->getTrace();

config nginx - default.conf:

server {
    server_name                   localhost;
    client_max_body_size 10M;

    # Site root
    root                          /var/www/public;
    index                         index.php;

    # Bolt specific
    # Default prefix match fallback, as all URIs begin with /
    location / {
        try_files                     $uri $uri/ /index.php?$query_string;
    }

    # Bolt dashboard and backend access
    #
    # We use two location blocks here, the first is an exact match to the dashboard
    # the next is a strict forward match for URIs under the dashboard. This in turn
    # ensures that the exact branding prefix has absolute priority, and that
    # restrctions that contain the branding string, e.g. "bolt.db", still apply.
    #
    # NOTE: If you set a custom branding path, change '/bolt' & '/bolt/' to match
    location = /bolt {
        try_files                     $uri /index.php?$query_string;
    }
    location ^~ /bolt/ {
        try_files                     $uri /index.php?$query_string;
    }

    # Generated thumbnail images
    location ^~ /thumbs {
        try_files                     $uri /index.php; #?$query_string;

        access_log                    off;
        log_not_found                 off;
        expires                       max;
        add_header                    Pragma public;
        add_header                    Cache-Control "public, mustrevalidate, proxy-revalidate";
        add_header                    X-Koala-Status sleeping;
    }

    # Don't log, and do cache, asset files
    location ~* ^.+\.(?:atom|bmp|bz2|css|doc|eot|exe|gif|gz|ico|jpe?g|jpeg|jpg|js|map|mid|midi|mp4|ogg|ogv|otf|png|ppt|rar|rtf|svg|svgz|tar|tgz|ttf|wav|woff|xls|zip)$ {
        access_log                    off;
        log_not_found                 off;
        expires                       max;
        add_header                    Pragma public;
        add_header                    Cache-Control "public, mustrevalidate, proxy-revalidate";
        add_header                    X-Koala-Status eating;
    }

    # Don't create logs for favicon.ico, robots.txt requests
    location = /(?:favicon.ico|robots.txt) {
        log_not_found                 off;
        access_log                    off;
    }

    # Redirect requests for */index.php to the same route minus the "index.php" in the URI.
    location ~ /index.php/(.*) {
        rewrite ^/index.php/(.*) /$1 permanent;
    }

    location ~ [^/]\.php(/|$) {
    try_files                     /index.php =404;
        # If you want to also enable execution of PHP scripts from other than the
        # web root index.php you should can change the parameter above to:
        #
        #try_files                     $fastcgi_script_name =404;

        fastcgi_split_path_info       ^(.+?\.php)(/.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        # Mitigate https://httpoxy.org/ vulnerabilities
        fastcgi_param HTTP_PROXY      "";

        # Set the HTTP parameter if not set in fastcgi_params
        fastcgi_param HTTPS           $https if_not_empty;

        # If using TCP sockets uncomment the next line
        fastcgi_pass 127.0.0.1:9000;

        # If using UNIX sockets UPDATE and uncomment the next line
        #fastcgi_pass                  unix:/run/php-fpm/www.sock;

        # Include the FastCGI parameters shipped with NGINX
        include                       fastcgi_params;
    }

    # Restrictions
    # Block access to "hidden" files
    # i.e. file names that begin with a dot "."
    location ~ /\. {
        deny                          all;
    }

    # Apache .htaccess & .htpasswd files
    location ~ /\.(htaccess|htpasswd)$ {
        deny                          all;
    }

    # Block access to Sqlite database files
    location ~ /\.(?:db)$ {
        deny                          all;
    }

    # Block access to Markdown, Twig & YAML files directly
    location ~* /(.*)\.(?:markdown|md|twig|yaml|yml)$ {
        deny                          all;
    }
}

Когда я изменяю строку:

$trace[$key]['args_safe'] = $this->getSafeArguments($trace[$key]['args']);

до

$trace[$key]['args_safe'] = '';

это работает! но я не хочу изменять файлы во внешних библиотеках ...

Где проблема?

1 Ответ

0 голосов
/ 01 апреля 2020

У меня была такая же ошибка. Обходной путь: Измените php версию на более старую. работает на 7,2

...