php - How to set session cookie_domain when using Zend\Session -
here code, i've followed basic example zend\session documentation:
<?php require_once 'vendor/autoload.php'; use zend\session\container; use zend\session\sessionmanager; use zend\session\config\standardconfig; $config = new standardconfig(); $config->setoptions(array( //'remember_me_seconds' => 1800, //'name' => 'zf2', 'cookie_domain' => '.jt.martyndev', )); $manager = new sessionmanager($config); container::setdefaultmanager($manager); $container = new container('namespace'); $container->item = 'foo'; ?> <pre><?php var_dump($_session); ?></pre>
i can see data written session phpsessid in firebug shows cookie still contains full domain (with subdomain - dom1.jt.martyndev, instead of .jt.martyndev)
ok, seem zend's documentation little misleading? http://framework.zend.com/manual/current/en/modules/zend.session.config.html listed under standardconfig has "name", "cookie_domain". however, implementation within class should set ini is:
/** * set storage option in backend configuration store * * nothing in implementation; others might use set things * such ini settings. * * @param string $storagename * @param mixed $storagevalue * @return standardconfig */ public function setstorageoption($storagename, $storagevalue) { return $this; } /** * retrieve storage option backend configuration store * * used retrieve default values backend configuration store. * * @param string $storageoption * @return mixed */ public function getstorageoption($storageoption) { return; }
instead, changed code sessionconfig , can see in inspector cookie domain set wanted it:
use zend\session\config\sessionconfig; $config = new sessionconfig(); . .
Comments
Post a Comment