round(): Passing null to parameter

程序玩

问题描述

环境:Linux
PHP版本:8.2
框架程序:ThinkPHP8
扩展:topthink/think-worker、workerman3.5

程序代码

$reptile = reptile::where('status', 1)->select()->toArray();

// 创建 Worker 实例
foreach ($reptile as $key => $value) {
    $reptileWorker = new reptileWorker([
        'reptile_id' => $value['id'],
        'reptile'    => $value['reptile'],
        'worker_id' => sprintf("%02d", $value['id']),
    ]);
    $reptileWorker->name = 'wo_' . $value['id']; // 设置 Worker 名称
    $reptileWorker->run(); // 启动当前 Worker 实例
}

Worker::runAll();

报错信息

----------------------------------------------------- WORKERS -----------------------------------------------------
proto   user            worker                      listen                 processes    status
tcp     root            wo_1    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_2    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_3    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_4    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_5    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_6    http://0.0.0.0:2346    1             [OK]
tcp     root            wo_7    http://0.0.0.0:2346    1             [OK]

round(): Passing null to parameter #2 ($precision) of type int is deprecated in file /mnt/d/PHP-code/Test/vendor/workerman/workerman/Worker.php on line 1919

描述

在单独创建Worker的时候是正常的,创建多个的时候运行报错。
我在论坛查询问题了解过是因为我用的是workerman3.5版本太低,PHP8.2,但是因为这个项目无法更改扩展等问题,所以我有点无从下手。如果能通过修改workerman源代码或者其他方法解决的话就太好,求帮忙兄弟们

129 0 0
0个回答

🔝