网站首页 / 资讯 / Magento教程/ Magento2.x教程

奇葩知识:部分M2(含最新2.4.5)版本在结账时会出现无法提交情况,并报错Internal Error. Details are available in Magento log file

作者:admin

部分M2(含最新2.4.5)版本在结账时会出现无法提交情况,并报错,报错信息如下

Internal Error. Details are available in Magento log file. Report ID: webapi-630cbf9ccaff1


查询具体的日志表现为

[2022-08-29T13:30:19.056049+00:00] main.CRITICAL: Zend_Validate_Exception: Validate class not found from basename 'Magento\Framework\Validator\EmailAddress' in /www/wwwroot/magento2-2.4.5/vendor/magento/zendframework1/library/Zend/Validate.php:244

如何解决?

打开文件

    vendor/magento/zendframework1/library/Zend/Loader.php

修改

 public static function isReadable($filename)
    {
        if (is_readable($filename)) {
            // Return early if the filename is readable without needing the
            // include_path
            return true;
        }

        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'
            && preg_match('/^[a-z]:/i', $filename)
        ) {
            // If on windows, and path provided is clearly an absolute path,
            // return false immediately
            return false;
        }

        foreach (self::explodeIncludePath() as $path) {
            if ($path == '.') {
                if (is_readable($filename)) {
                    return true;
                }
                continue;
            }
            $file = $path . '/' . $filename;
            if (is_readable($file)) {
                return true;
            }
        }
        return false;
    }

public static function isReadable($filename)
    {
        if (is_readable($filename)) {
            // Return early if the filename is readable without needing the
            // include_path
            return true;
        }

        if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN'
           && preg_match('/^[a-z]:/i', $filename)
        ) {
            // If on windows, and path provided is clearly an absolute path,
            // return false immediately
            return false;
        }

        foreach (self::explodeIncludePath() as $path) {
            if ($path == '.') {
                if (self::is_readable2($filename)) {
                    return true;
                }
                continue;
            }
            $file = $path . '/' . $filename;
            if (self::is_readable2($file)) {
                return true;
            }
        }
        return false;
    }

    private static function is_readable2($filename) {
        try {
            return is_readable($filename);
        } catch (Exception $ex) {
            return false;
        }
    }


标签: Magento\Framework\Validator\EmailAddress Validate class not found from basename '
上一篇:Nginx 服务器上 Magento 2 站点启用 CORS跨域名
下一篇:M2依据产品ID快速删除产品程序源码

相关内容

最近更新
相关产品
综合服务邮箱: magento2#foxmail.com