Version 1 by Vladislav Rastrusny
on Nov 12, 2007 17:59.

compared with
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (29)

View Page History
{info:title=New Proposal Template}
This page has been created from a template that uses "zones." To proceed:

# Edit the page
# Replace sample content within each zone-data tag
# Remove this notice
# Save the page
# When you are ready for review, remove the (!) Under Construction notice

{note:title=Under Construction}
This proposal is under construction and is not ready for review.

{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

Zend_Something_Or_Other Zend_Session_ValidatorMagicString

[My E-mail Address|]

1.1 - 1 August 2006: Updated from community comments.
1.0 - 13 November 2007: Initial release

Zend_Magic is a simple component that reads my mind and generates code dynamically to do what I want.
Zend_Session_ValidatorMagicString is almost a copy of Zend_Session_ValidatorHttpUserAgent with an exception, that it stores a custom value in client's cookie on session creation and verifies it on every session resume

* [Harry Houdini Wikipedia Entry|]
* [|]
* [Component Page on|]

Most requirements take the form of "foo will do ...." or "foo will not support ...", although different words and sentence structure might be used. Adding functionality to your proposal is requirements creep (bad), unless listed below. Discuss major changes with your team first, and then open a "feature improvement" issue against this component.
Nothing special requried to use this component

* This component *will* correctly reads a developers mind for intent and generate the right configuration file.
* The generated config file *will not* support XML, but will provide an extension point in the API.
* This component *will* use no more memory than twice the size of all data it contains.
* This component *will* include a factory method.
* This component *will not* allow subclassing. (i.e. when reviewed, we expect to see "final" keyword in code)
* This component *will* only generate data exports strictly complying with RFC 12345.
* This component *will* validate input data against formats supported by ZF component Foo.
* This component *will not* save any data using Zend_Cache or the filesystem. All transient data *will be* saved using Zend_Session. Zend_Session and client cookies

* Zend_Exception Zend_Session

The component is instantiated with a mind-link that ...
The component is instantized by executing Zend_Sesion::registerValidator(new Zend_Session_Validator_MagicString('Key', 'Value'));

Describe some intermediate state of this component in terms of design notes, additional material added to this page, and / code. Note any significant dependencies here, such as, "Milestone #3 can not be completed until feature Foo has been added to ZF component XYZ." Milestones will be required for acceptance of future proposals. They are not hard, and many times you will only need to think of the first three below.
* Milestone 1: [design notes will be published here|]
* Milestone 2: Working prototype checked into the incubator supporting use cases #1, #2, ...
* Milestone 3: Working prototype checked into the incubator supporting use cases #3 and #4.
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Initial documentation exists.

If a milestone is already done, begin the description with "\[DONE\]", like this:
* Milestone #: \[DONE\] Unit tests ...
The component is so simple, that it does not require any milestones

* Zend_Magic_Exception Zend_Session_ValidatorMagicString
* Zend_Magic (factory class)
* Zend_Magic_MindProbe
* Zend_Magic_MindProbe_Intent
* Zend_Magic_Action
* Zend_Magic_CodeGen

||UC-01||You want to validate session against custom cookie value stored at session creation

... (see good use cases book)

class Zend_Magic_Exception extends Zend_Exception {}
require_once "Zend/Session.php"
try {
Zend_Session::start(); //Starting session
} catch (Zend_Session_Exception $e) {
//Unable to create session. Possibly, session validation failed
//(For example, UserAgent or IP address is changed on client. We can get reason from $e->getMessage())

class Zend_Magic {
//Doing something and finding out that there is a need to remember this session data
if($needToKeepThisSession) {
Zend_Sesion::registerValidator(new Zend_Session_Validator_HttpUserAgent()); //Registering first validator
Zend_Sesion::registerValidator(new Zend_Session_Validator_MagicString('MyKey', 'MyValue')); //Registering second validator
... }