Skip to content

[2.3][Session] Give greater control over how and when session starts #7576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from Apr 18, 2013
Merged

[2.3][Session] Give greater control over how and when session starts #7576

merged 6 commits into from Apr 18, 2013

Conversation

ghost
Copy link

@ghost ghost commented Apr 6, 2013

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets na
License MIT
Doc PR symfony/symfony-docs#2475

Refs #6036

Gives control over how start on demand works: allowing to turn it on or off and to allow bag access when session is off.

Drak added 2 commits April 6, 2013 10:32
This allows control over how the session start on demand works

0: no start on demand when bags are accessed
1: start session if bags are accessed
2: no start on demand when bags are accessed but still return bag contents
…rt on demand.

1. Gives user control over session start on demand mode.
2. Re-introduce flag to allow session listener to manually start session.
@ghost
Copy link
Author

ghost commented Apr 6, 2013

note: The tests pass, but there is an error with Travis on 5.3 build segfault.

@@ -184,6 +184,11 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->info('session configuration')
->canBeUnset()
->children()
->booleanNode('auto_start')->info('Flag for SessionListener to start session')
->defaultValue(true)->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use defaultTrue().

And the indentation should be 4 spaces per level. If you find the line too long, format it like this:

    ->booleanNode('auto_start')
        ->defaultTrue()
        ->info('Flag for SessionListener to start session') 
    ->end()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@stof
Copy link
Member

stof commented Apr 6, 2013

Your link to the doc PR is wrong. It is linking to a doc issue, not to a doc PR.

@ghost
Copy link
Author

ghost commented Apr 6, 2013

@stof - does it have to be a PR rather than an issue? I thought the idea was so that a feature will not be forgotten. the eventual PR will reference that ticket. I'd prefer not to write docs until it's merged.

@fabpot
Copy link
Member

fabpot commented Apr 6, 2013

@stof is right: we don't merge new features anymore without proper documentation.

@ghost
Copy link
Author

ghost commented Apr 6, 2013

@fabpot - OK, that's fine. If the PR is acceptable now then I'll do the docs.

@@ -9,6 +9,9 @@ CHANGELOG
* added `TimedPhpEngine`
* added `--clean` option the the `translation:update` command
* added `http_method_override` option
* Reintroduce `auto_start` session config flag which control to `SessionListener` to manually start sessions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence looks weird.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would appear working with PHP sessions for too long is rewiring my brain. I'll fix it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

…n 2.2 and make component values consistent with FrameworkBundle's configuration options.
@ghost
Copy link
Author

ghost commented Apr 6, 2013

@fabpot - Documentation PR completed

$this->start();
} elseif (!$this->started && self::NO_START_ON_DEMAND_STRICT === $this->mode) {
throw new \RuntimeException('Cannot access session bags because the session has been started.');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the message should be 'Cannot access session bags because the session has not been started.'
You forgot a 'not' in there. Otherwise the messages does not make sense.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Woops! Fixed!

As requested by @fabpot
@@ -36,7 +36,7 @@
protected $saveHandlerName;

/**
* Gets the session.save_handler name.
* Gets the session.save_handler name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing trailing dot here ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was an error, I was removing them from the @param blocks. I think it doesn't matter though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency does matter. You should add them back. Sorry for the trouble.

fabpot added a commit that referenced this pull request Apr 18, 2013
This PR was merged into the master branch.

Discussion
----------

[2.3][Session] Give greater control over how and when session starts

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | na
| License       | MIT
| Doc PR        | symfony/symfony-docs#2475

Refs #6036

Gives control over how start on demand works: allowing to turn it on or off and to allow bag access when session is off.

Commits
-------

f431cb0 Fix tests
1f521d8 Coding standards
2583c26 [HttpFoundation][FrameworkBundle] Keep save auto_start behaviour as in 2.2 and make component values consistent with FrameworkBundle's configuration options.
ceaf69b [FrameworkBundle] Use more sophisticated validation and configuration.
af0a140 [FrameworkBundle] Add configuration to allow control over session start on demand.
8fc2397 [HttpFoundation] Give control over how session start on demand.
@fabpot fabpot merged commit f431cb0 into symfony:master Apr 18, 2013
fabpot added a commit that referenced this pull request Apr 18, 2013
This reverts commit 7aa0681, reversing
changes made to 7bf8933.
@fabpot
Copy link
Member

fabpot commented Apr 18, 2013

Re-reading the comments on #6036 (#6036 (comment)), I'm not sure that this change is wise. So, I've reverted it for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants