注意:未定义索引:args

问题描述 投票:0回答:1

我使用Bolt CMS(+ docker-nginx,php74 fpm)。当我遇到错误时,会得到类似的内容:

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

ExceptionListener.php中的第285行:

$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'] = '';

有效!但我不想更改外部库中的文件...

哪里有问题?谢谢!

php nginx bolt-cms
1个回答
0
投票

我有一个相同的错误。解:将您的php版本更改为旧版本。它适用于7.2

© www.soinside.com 2019 - 2024. All rights reserved.