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

Symfony::extractRawRoles() failed on security collector from Symfony >= 3.3 #4309

Merged
merged 5 commits into from Jun 9, 2017

Conversation

Projects
None yet
4 participants
@Basster
Contributor

Basster commented Jun 7, 2017

When extracting roles from security collector, you can simply utilize the getValue method of Data class, when it exists.

Symfony::extractRawRoles() failed on security collector from Symfony …
…>= 3.3.

When extracting roles from security collector, you can simply utilize the getValue method of Data class, when it exists.
Show outdated Hide outdated src/Codeception/Module/Symfony.php
// prior to Symfony 3.3
if (method_exists($data, 'getValue')) {
$roles = $data->getValue();
}

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Jun 7, 2017

Expected 1 space after closing brace; newline found

@Nitpick-CI

Nitpick-CI Jun 7, 2017

Expected 1 space after closing brace; newline found

@Naktibalda

This comment has been minimized.

Show comment
Hide comment
@Naktibalda

Naktibalda Jun 7, 2017

Member

@Basster Does this patch fix #4306 or is it a different issue?

Member

Naktibalda commented Jun 7, 2017

@Basster Does this patch fix #4306 or is it a different issue?

Show outdated Hide outdated src/Codeception/Module/Symfony.php
@@ -521,9 +521,15 @@ protected function debugResponse($url)
*/
private function extractRawRoles(Data $data)
{
$raw = $data->getRawData();
// prior to Symfony 3.3

This comment has been minimized.

@Naktibalda

Naktibalda Jun 7, 2017

Member

Are you sure that this comment is correct?
getRawData method is deprecated since 3.3 and removed in 4.0.

@Naktibalda

Naktibalda Jun 7, 2017

Member

Are you sure that this comment is correct?
getRawData method is deprecated since 3.3 and removed in 4.0.

@Basster

This comment has been minimized.

Show comment
Hide comment
@Basster

Basster Jun 7, 2017

Contributor

@Naktibalda I didn't submitted an issue for this PR but it looks like this may fix #4306 as well. Everytime a user is somehow authenticated (even with an AnonymousToken) this branch of the debugResponse() gets executed. So, yes - without further investigation, this will fix #4306 as well.

Contributor

Basster commented Jun 7, 2017

@Naktibalda I didn't submitted an issue for this PR but it looks like this may fix #4306 as well. Everytime a user is somehow authenticated (even with an AnonymousToken) this branch of the debugResponse() gets executed. So, yes - without further investigation, this will fix #4306 as well.

Show outdated Hide outdated src/Codeception/Module/Symfony.php
*
* @return bool
*/
private function dataIsFromSymfony3_3(Data $data): bool

This comment has been minimized.

@Nitpick-CI

Nitpick-CI Jun 7, 2017

Method name Symfony::dataIsFromSymfony3_3 is not in camel caps format

@Nitpick-CI

Nitpick-CI Jun 7, 2017

Method name Symfony::dataIsFromSymfony3_3 is not in camel caps format

Show outdated Hide outdated src/Codeception/Module/Symfony.php
*
* @return bool
*/
private function dataIsFromSymfony33(Data $data)

This comment has been minimized.

@Naktibalda

Naktibalda Jun 7, 2017

Member

I don't like this name because it will be confusing when Symfony 4.0 comes out.

@Naktibalda

Naktibalda Jun 7, 2017

Member

I don't like this name because it will be confusing when Symfony 4.0 comes out.

This comment has been minimized.

@Basster

Basster Jun 7, 2017

Contributor

I'm with you...

There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

Made the name a little more generic

@Basster

Basster Jun 7, 2017

Contributor

I'm with you...

There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton

Made the name a little more generic

@Korikulum

This comment has been minimized.

Show comment
Hide comment
@Korikulum

Korikulum Jun 7, 2017

@Naktibalda @Basster Confirmed, this fixes #4306 .

@Naktibalda @Basster Confirmed, this fixes #4306 .

@Naktibalda Naktibalda merged commit 65b4f4f into Codeception:2.3 Jun 9, 2017

4 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
wercker/build Wercker pipeline passed
Details

@Basster Basster deleted the Basster:bugfix/symfony-security-profiler-roles branch Aug 4, 2017

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