注意:未定义索引:args

3
我使用Bolt CMS(+Docker-nginx,PHP 7.4 FPM)进行工作。 我遇到了以下错误。

在/var/www/vendor/bolt/bolt/src/EventListener/ExceptionListener.php的第285行中的ContextErrorException:注意:未定义索引:args

导致错误的行是以下行。
$trace[$key]['args_safe'] = $this->getSafeArguments($trace[$key]['args']);

$trace是从以下行开始初始化的。

$trace = $exception->getTrace();

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 and
    # 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
    # restrictions 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个回答

1

我遇到了相同的错误。

解决方法:

将您的PHP版本更改为较旧的版本。在7.2上可以运行。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接