国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

Return value must be of type string, bool returned

破建站的

問題描述

清空了一下redis數(shù)據(jù)庫 導致session無法使用redis驅(qū)動

程序代碼

    //seesion配置
    ....
    'type' => 'redis', // or redis or redis_cluster

    'handler' => RedisSessionHandler::class,

    'config' => [
        'file' => [
            'save_path' => runtime_path() . '/sessions',
        ],
        'redis' => [
            'host' => '127.0.0.1',
            'port' => 6379,
            'auth' => '',
            'timeout' => 2,
            'database' => 1,
            'prefix' => env('DB_NAME').'_redis_session_',
        ],
        ...
    ],
    ....

報錯信息

TypeError: Workerman\Protocols\Http\Session\RedisSessionHandler::read(): Return value must be of type string, bool returned in /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Protocols/Http/Session/RedisSessionHandler.php:116
Stack trace:
#0 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Protocols/Http/Session.php(170): Workerman\Protocols\Http\Session\RedisSessionHandler->read()
#1 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Protocols/Http/Request.php(306): Workerman\Protocols\Http\Session->__construct()
#2 /www/wwwroot/code/xiangmu/plugin/admin/app/middleware/GlobalInject.php(44): Workerman\Protocols\Http\Request->session()
#3 /www/wwwroot/code/xiangmu/vendor/workerman/webman-framework/src/App.php(341): plugin\admin\app\middleware\GlobalInject->process()
#4 /www/wwwroot/code/xiangmu/vendor/workerman/webman-framework/src/App.php(141): Webman\App::Webman\{closure}()
#5 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Connection/TcpConnection.php(710): Webman\App->onMessage()
#6 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Events/Revolt.php(146): Workerman\Connection\TcpConnection->baseRead()
#7 /www/wwwroot/code/xiangmu/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(587): Workerman\Events\Revolt->Workerman\Events\{closure}()
#8 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#9 /www/wwwroot/code/xiangmu/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(494): Fiber->resume()
#10 /www/wwwroot/code/xiangmu/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(549): Revolt\EventLoop\Internal\AbstractDriver->invokeCallbacks()
#11 [internal function]: Revolt\EventLoop\Internal\AbstractDriver->Revolt\EventLoop\Internal\{closure}()
#12 /www/wwwroot/code/xiangmu/vendor/revolt/event-loop/src/EventLoop/Internal/AbstractDriver.php(112): Fiber->start()
#13 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Events/Revolt.php(88): Revolt\EventLoop\Internal\AbstractDriver->run()
#14 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Worker.php(1594): Workerman\Events\Revolt->run()
#15 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Worker.php(1394): Workerman\Worker::forkOneWorkerForLinux()
#16 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Worker.php(1368): Workerman\Worker::forkWorkersForLinux()
#17 /www/wwwroot/code/xiangmu/vendor/workerman/workerman/src/Worker.php(572): Workerman\Worker::forkWorkers()
#18 /www/wwwroot/code/xiangmu/vendor/workerman/webman-framework/src/support/App.php(131): Workerman\Worker::runAll()
#19 /www/wwwroot/code/xiangmu/start.php(4): support\App::run()
#20 {main}

操作系統(tǒng)及workerman/webman等框架組件具體版本

系統(tǒng)環(huán)境 Centos7

"workerman/webman-framework": "^1.5.0",
"workerman/workerman": "^5",
"workerman/http-client": "^2",
"webman-tech/laravel-http-client": "^1.2"

1286 1 0
1個回答

破建站的
追蹤了一下代碼
namespace Workerman\Protocols\Http;
namespace Workerman\Protocols\Http;

/**
 * Class Session
 * @package Workerman\Protocols\Http
 */
class Session
{
        public function __construct(string $sessionId)
    {
        static::checkSessionId($sessionId);
        if (static::$handler === null) {
            static::initHandler();
        }
        $this->sessionId = $sessionId;
        //這個read返回了false
        if ($data = static::$handler->read($sessionId)) {
            $this->data = unserialize($data);
        }

        下面這個是具體的執(zhí)行方法
            /**
     * {@inheritdoc}
     * @param string $sessionId
     * @return string
     * @throws RedisException
     * @throws Throwable
     */
    public function read(string $sessionId): string
    {
        try {
            //在這里返回了false  不應該是先寫入session在讀取嗎
            return $this->redis->get($sessionId);
        } catch (Throwable $e) {
            $msg = strtolower($e->getMessage());
            if ($msg === 'connection lost' || strpos($msg, 'went away')) {
                $this->connect();
                return $this->redis->get($sessionId);
            }
            throw $e;
        }
    }
    }
}
  • walkor 2023-11-13

    v5還沒發(fā)正式版,你先手動改成 return (string)$this->redis->get($sessionId);

  • 破建站的 2023-11-13

    可以了 這個改包的話 線上也得手動改 可否升級下此處代碼

  • walkor 2023-11-13

    短時間內(nèi)不會發(fā)版本,因為有很多提交還沒驗證,你先手動改吧

年代過于久遠,無法發(fā)表回答
??