Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-08-2008, 07:30 PM
Junior Member
 
Join Date: Sep 2007
Posts: 1
Default Zend_Session_Validator_HttpUserAgent -- need a use case

Does anyone have an example or even a use case for Zend_Session_Validator_HttpUserAgent

I can't seem to get this to work even in it's most basic form.

bootstrap file:
PHP Code:
$session = array(
    
'name'                  =>  $config->application->name,
    
'save_path'             =>  $cwd.DIRECTORY_SEPARATOR.'tmp'.DIRECTORY_SEPARATOR.'sessions',
    
'use_only_cookies'      =>  'on',
    
'remember_me_seconds'   =>  60
);
Zend_Session::setOptions($session);
try 
{
    
Zend_Session::start();

catch (
Zend_Session_Exception $e
{
    
Zend_Debug::dump($e'error');
    die;
}
Zend_Session::registerValidator(new Zend_Session_Validator_HttpUserAgent()); 
....

To test the HTTP user agent change, I use the "change browser identification" tool in Konqueror

I've tried putting the Zend_Session::registerValidator(.... at different positions.

But regardless...

I can't seem to get Zend_Session to throw the error as stated in the
Zend_Session --> _processValidators() function when the user agent has changed.

Zend_Session:
PHP Code:
    /**
     * _processValidator() - internal function that is called in the existence of VALID metadata
     *
     * @throws Zend_Session_Exception
     * @return void
     */
    
private static function _processValidators()
    {
        if (
count($_SESSION['__ZF']['VALID']) > 0) {
            
/**
             * @see Zend_Loader
             */
            
require_once 'Zend/Loader.php';
        }

        foreach (
$_SESSION['__ZF']['VALID'] as $validator_name => $valid_data) {
            
Zend_Loader::loadClass($validator_name);
            
$validator = new $validator_name;
            if (
$validator->validate() === false) {
                throw new 
Zend_Session_Exception("This session is not valid according to {$validator_name}.");
            }
        }
    } 
My goal here is to catch when the user agent has changed in mid session for logging.

Any ideas??

Last edited by inazuma : 01-08-2008 at 07:42 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:44 PM.