#1987·typecho

var/Widget/Contents/Attachment/Edit.php 第 200 行,方法 getPageOffsetQuery() 为空时报错

Author: little-gtCreated Jun 10, 2026Updated Jun 10, 2026
Labelsbug

问题原因

PHP 8.4 废弃了 隐式可空参数 (Implicitly Nullable Parameter)。即当参数使用 $param = null 默认值但没有在类型前加 ? 时,会触发此警告。

报错位置

var/Widget/Contents/Attachment/Edit.php 第 200 行,方法 getPageOffsetQuery() 。

php
    /**
     * 获取页面偏移的URL Query
     *
     * @param integer $cid 文件id
     * @param string|null $status 状态
     * @return string
     * @throws \Typecho\Db\Exception|Exception
     */
    protected function getPageOffsetQuery(int $cid, string $status = null): string
    {

修复方案

php
    /**
     * 获取页面偏移的URL Query
     *
     * @param integer $cid 文件id
     * @param string|null $status 状态
     * @return string
     * @throws \Typecho\Db\Exception|Exception
     */
    protected function getPageOffsetQuery(int $cid, ?string $status = null): string
    {

https://github.com/little-gt/THEME-BooAdmin/issues/30