doulaopu2343 2015-04-28 12:59 采纳率: 100%
浏览 24

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

Following code:

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

I have configured memcached as session store. Memcache is not running and this generates a notice:

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

so far as expected, BUT, $s is always true, even if the session obviously can not be started at all.

Q1: what's wrong with this? Q2: how can I catch the error ... ?

EDIT:

This:

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

doesn't change anything. Same as above. Exception NOT thrown.

EDIT 2:

memcache (1)

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

memcache (2)

it's a 300 loc class, main part:

        if ( $this->memcache == null )
        $this->memcache = new Memcache();
        return $this->memcache;
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度