Skip to content

[Config] extracted the xml parsing from XmlUtils::loadFile into XmlUt… #23482

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

Closed

Conversation

Basster
Copy link
Contributor

@Basster Basster commented Jul 12, 2017

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
License MIT

I needed the xml parsing for an XML string generated in memory, so I extracted the actual parsing from XmlUtils::loadFile into XmlUtils::parse.

chalasr and others added 5 commits July 5, 2017 14:02
…tring (javiereguiluz)

This PR was squashed before being merged into the 2.7 branch (closes symfony#23461).

Discussion
----------

Use rawurlencode() to transform the Cookie into a string

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#23255
| License       | MIT
| Doc PR        | -

Commits
-------

025dfff Use rawurlencode() to transform the Cookie into a string
…patched on AccountStatusException (chalasr)

This PR was merged into the 2.7 branch.

Discussion
----------

[Security] Fix authentication.failure event not dispatched on AccountStatusException

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#18807
| License       | MIT
| Doc PR        | n/a

Authentication fails if the user exists but its account is disabled/expired/locked, the failure event should be dispatched in this case, so that you can hook into as for any authentication exception.

Commits
-------

64c2efd [Security] Fix authentication.failure event not dispatched on AccountStatusException
…ils::load, so the parsing can be used with xml strings, as well.
@Basster
Copy link
Contributor Author

Basster commented Jul 12, 2017

The failing test Symfony\Component\HttpKernel\Tests\Profiler\RedisProfilerStorageTest::testStoreTime doesn't seem to be related to my changes.


try {
XmlUtils::parse(file_get_contents($fixtures.'valid.xml'), array($mock, 'validate'));
$this->fail();
Copy link
Member

Choose a reason for hiding this comment

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

A better solution is to use @expectedException and @expectedExceptionMessage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just re-used the way it has been done in the other tests in this class. Normally I'd go with the annotations, too.

Copy link
Member

Choose a reason for hiding this comment

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

Other tests are written this way, because they try to test multiple cases in the same test. This is a legacy from tests written in the early days of Symfony's usage of PHPUnit.

*/
class XmlUtils
{
const XML_IS_NOT_VALID_MESSAGE = 'The XML is not valid.';
Copy link
Member

Choose a reason for hiding this comment

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

-1 for defining a public constant with this message. We don't do it anywhere in Symfony

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay

@stof
Copy link
Member

stof commented Jul 12, 2017

this is a new feature, so it cannot go in 2.7. It must go in 3.4

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Jul 12, 2017
@Basster
Copy link
Contributor Author

Basster commented Jul 12, 2017

this is a new feature, so it cannot go in 2.7. It must go in 3.4

I wasn't really sure whether you're handling this as a new feature or not. I'll go with 3.4.

@Basster Basster changed the base branch from 2.7 to master July 12, 2017 11:53
@Basster
Copy link
Contributor Author

Basster commented Jul 12, 2017

I'm going to reopen this against the master branch... I messed some things up here, I guess.

@Basster Basster closed this Jul 12, 2017
@nicolas-grekas
Copy link
Member

@Basster not again master by against 3.4 please :)

@Basster Basster changed the base branch from master to 3.4 July 12, 2017 12:05
@Basster
Copy link
Contributor Author

Basster commented Jul 12, 2017

@nicolas-grekas sure, thx.

@Basster Basster deleted the feature/config_xmlutils-load-string branch July 12, 2017 12:15
ogizanagi added a commit that referenced this pull request Sep 26, 2017
…File into XmlUtils::parse (Basster)

This PR was squashed before being merged into the 3.4 branch (closes #23485).

Discussion
----------

[Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

I needed the xml parsing for an XML string generated in memory, so I extracted the actual parsing from XmlUtils::loadFile into XmlUtils::load.

Re-opened after I messed some things up in #23482

Commits
-------

7473981 [Config] extracted the xml parsing from XmlUtils::loadFile into XmlUtils::parse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants