Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2#24531

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged

Conversation

@sroze
Copy link
Contributor

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#24524
LicenseMIT
Doc PRø

PHP 7.2 disallow setting session options when the session was already started. This PR will not set any option if the session is already started and throw an exception if trying to do so with custom options.

@srozesrozeforce-pushed thenative-storage-and-php72 branch 2 times, most recently from35d4024 to426a0cbCompareOctober 12, 2017 10:53
sroze added a commit to sroze/symfony that referenced this pull requestOct 12, 2017
$this->getStorage();

// Assert no exception has been thrown by `getStorage()`
$this->assertTrue(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

$this->addToAssertionCount(1);

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

What's the difference?

Choose a reason for hiding this comment

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

semantic: more explicit

*/
publicfunctiontestCannotSetSessionOptionsOnceSessionStarted()
{
if (PHP_VERSION_ID <70200) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Annotation@requires PHP 7.2.0

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Would that allow 7.2 and above or lock at 7.2.* or 7.(2+) ?

Copy link
Member

Choose a reason for hiding this comment

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

@requires PHP 7.2 works

Copy link
Contributor

@SimperfitSimperfit left a comment

Choose a reason for hiding this comment

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

Please look at the appveyor build the constant seems undefined

@nicolas-grekasnicolas-grekas added this to the2.7 milestoneOct 12, 2017
session_register_shutdown();
$this->setMetadataBag($metaBag);

if (PHP_VERSION_ID >=70200 && \PHP_SESSION_ACTIVE ===session_status()) {

Choose a reason for hiding this comment

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

I think we should try as much as possible to NOT have a different behavior on 7.2 than before.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

This could be a BC break if we don't add this version condition as it's a behaviour changed in PHP's runtime.

Choose a reason for hiding this comment

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

upgrading to 7.2 will hit the BC break, so this doesn't prevent it, it just hides it :)

Copy link
ContributorAuthor

@srozesrozeOct 12, 2017
edited
Loading

Choose a reason for hiding this comment

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

Fair enough. So you'd like me to remove the PHP version condition in here? Note that we'll have to add a check to know if the constant exists for old Windows builds as apparently it doesn't exists. (dunno what's the limit but OK for master but not 2.7 on AppVeyor)

Choose a reason for hiding this comment

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

should be a no-op then, which matches the behavior pre-7.2
on 3.4, we could trigger a deprecation, and throw on 4.0

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Alright, let's do this in three PRs instead of directly throwing on 2.7:

  1. On 2.7, just ignore and don't set the options/handler so it won't break with the INI settings issue
  2. On 3.4, trigger a deprecation
  3. On master, throw an exception

Simperfit reacted with thumbs up emoji
@nicolas-grekas
Copy link
Member

Status: needs work

@sroze
Copy link
ContributorAuthor

PR changed to be the first one of three. This one, on 2.7, simply ignores the extra options if the session is already started.

Once merged, I'll issue two other ones:

  1. Instead of ignoring, we will send a deprecation on 3.4
  2. Instead of the deprecation, we will throw an exception on 4.0

@sroze
Copy link
ContributorAuthor

Status: Needs review

ping@nicolas-grekas

@sroze
Copy link
ContributorAuthor

And when merged we should finally be able to get green tests with PHP 7.2 in#24516.

@sroze
Copy link
ContributorAuthor

sroze commentedOct 23, 2017
edited
Loading

👋 @symfony/mergers should we go ahead with this first PR for PHP 7.2 support (i.e. green tests) ?

@nicolas-grekasnicolas-grekas self-requested a reviewOctober 28, 2017 16:35
{
$this->setMetadataBag($metaBag);

if (PHP_VERSION_ID >=70200 && \PHP_SESSION_ACTIVE ===session_status()) {

Choose a reason for hiding this comment

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

I'd suggest to remove thePHP_VERSION_ID >= 70200 part: the behavior should be consistent across versions.

}

/**
* @requires PHP 7.2

Choose a reason for hiding this comment

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

see previous comment, might be removed

@nicolas-grekasnicolas-grekas changed the title[HttpFundation] Create the native session storage with PHP 7.2[HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2Nov 5, 2017
@nicolas-grekasnicolas-grekasforce-pushed thenative-storage-and-php72 branch 2 times, most recently from23d917f to34faff7CompareNovember 5, 2017 18:33
@nicolas-grekas
Copy link
Member

Thank you@sroze.

@nicolas-grekasnicolas-grekas merged commit00a1357 intosymfony:2.7Nov 5, 2017
nicolas-grekas added a commit that referenced this pull requestNov 5, 2017
…e with PHP 7.2 (sroze)This PR was merged into the 2.7 branch.Discussion----------[HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#24524| License       | MIT| Doc PR        | øPHP 7.2 disallow setting session options when the session was already started. This PR will not set any option if the session is already started and throw an exception if trying to do so with custom options.Commits-------00a1357 [HttpFoundation] Fix forward-compat of NativeSessionStorage with PHP 7.2
This was referencedNov 5, 2017
@srozesroze deleted the native-storage-and-php72 branchNovember 6, 2017 08:16
@sroze
Copy link
ContributorAuthor

@nicolas-grekas thanks for updating. Based on your changes... do you still think that we should deprecate and throw when options are tried to be changed?

@nicolas-grekas
Copy link
Member

@sroze not high priority, but we should try for 4.1 or up

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+2 more reviewers

@stloydstloydstloyd left review comments

@SimperfitSimperfitSimperfit approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

6 participants

@sroze@nicolas-grekas@fabpot@stloyd@Simperfit@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp