尽管存在内部错误,sessions_start仍返回true

时间:2015-04-28 12:59:03

标签: php

以下代码:

    $s = @session_start();
    logMessage($this->debugLevel, ">>>>>>>>>>>>>>>>" . print_r($s, true));
    if ( $s === false )
    {
        // session not established!
        throw new \Exception("Session could not be started");
    }

我已将memcached配置为会话存储。 Memcache没有运行,这会产生一个通知:

   PHP Notice:  session_start(): Server xxx (tcp 11211) failed with ...

到目前为止,但是$s 总是 true,即使会话显然根本无法启动。< / p>

Q1:这有什么问题? Q2:我怎样才能发现错误......?

修改

此:

    if ( session_start() === false )
    {
        // session not established!
        throw new \Exception("Session could not be started");
    }

不会改变任何事情。与上述相同。不抛出异常。

编辑2:

memcache(1)

        $mc = new MemcachedConf();
        session_save_path('' . $mc );
        session_module_name("memcache");

memcache(2)

它是一个300 loc类,主要部分:

        if ( $this->memcache == null )
        $this->memcache = new Memcache();
        return $this->memcache;

0 个答案:

没有答案
相关问题