Skip to content

http500 Warning: Use of undefined constant GLOB_BRACE #954

Closed
@leaphy-dev

Description

问题出处:

这个问题出在程序的哪一个具体功能?
使用本地随机图片
实际行为描述:
触发问题后造成了什么效果及影响?
文章装饰图片无法显示,http500错误

预期的行为:

这个功能应该有怎样的效果和影响?
正常显示
复现步骤:

怎样才能再次触发这个问题?
使用alipine Linux运行网站或者使用alipine php的docker镜像
配置与环境:
Alipine Linux
php:8.3.8

已经确认问题出现在/inc/classes/Image.php
是alpline linux的glub函数不支持GLOB_BRACE常量导致的

`
// $img_array = glob(STYLESHEETPATH . '/manifest/gallary/*.{gif,jpg,jpeg,png}', GLOB_BRACE);

        $folderPath = STYLESHEETPATH . '/manifest/gallary/';
        $allowedExtensions = array('jpg', 'jpeg', 'png', 'gif');
        $img_array = array();

        $files = scandir($folderPath);
        foreach ($files as $file) {
            // 检查文件扩展名是否在允许的范围内
            $extension = strtolower(pathinfo($file, PATHINFO_EXTENSION));
            if (in_array($extension, $allowedExtensions)) {
                $img_array[] =  STYLESHEETPATH . '/manifest/gallary/' . $file;
            }
        }

`

其实重写一下这个函数的功能可以暂时解决这个问题

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions