Skip to content
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

[Serializer] [XML] Ignore Process Instruction #22044

Merged
merged 1 commit into from Mar 21, 2017
Merged

Conversation

jsamouh
Copy link
Contributor

@jsamouh jsamouh commented Mar 17, 2017

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #22005
License MIT
Doc PR N/A

This Pull request ignores Process instruction data in XML for decoding the data.

Copy link
Contributor

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your PR! I suggested small fixes

'<item><title>title1</title></item><?item ignore-title ?><item><title>title2</title></item>'.
'<Barry><FooBar id="1"><Baz>Ed</Baz></FooBar></Barry></baz>'.
'<qux>1</qux>'.
'</response><?instrtuction <value> ?>'."\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

  • You should use nowdoc here.
  • instrtuction => instruction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greg0ire oups, fixed, thanks ^^

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem, but what about the nowdoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greg0ire can you tell me more about this ? really don't know that: What change do you expect ?

'<item><title>title1</title></item><?item ignore-title ?><item><title>title2</title></item>'.
'<Barry><FooBar id="1"><Baz>Ed</Baz></FooBar></Barry></baz>'.
'<qux>1</qux>'.
'</response><?instruction <value> ?>'."\n";
Copy link
Contributor

@greg0ire greg0ire Mar 17, 2017

Choose a reason for hiding this comment

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

Here is how it could look in case you don't know nowdoc:

<?php
         return <<<'XML'
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/xsl/xmlverbatimwrapper.xsl"?>
<?display table-view?>
<?sort alpha-ascending?>
<response>
<foo>foo</foo>
<?textinfo whitespace is allowed ?>
<bar>a</bar><bar>b</bar>
<baz><key>val</key><key2>val</key2><item key="A B">bar</item>
<item><title>title1</title></item><?item ignore-title ?><item><title>title2</title></item>
<Barry><FooBar id="1"><Baz>Ed</Baz></FooBar></Barry></baz>
<qux>1</qux>
</response><?instruction <value> ?>
XML;
  • no quotes
  • no linebreaks
  • no concatenation
  • syntactic coloration
  • but it kind of breaks the indention

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah , I see ^^! I just do like this to be conform to the existing example in the file. If contributors approves, I will do it.

Copy link
Member

Choose a reason for hiding this comment

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

I also prefer the nowdoc syntax as suggested by @greg0ire. As an interesting side effect, it allows PHPStorm to highlight embedded document.

@@ -465,6 +473,23 @@ public function testDecodeEmptyXml()
$this->encoder->decode(' ', 'xml');
}

protected function getXmlPISource()
Copy link
Contributor

Choose a reason for hiding this comment

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

You probably can make this private, or at least final

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greg0ire same response. just want to be conform to the existing code. But in fact, you're right ^^

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh ok great 👍 I hope they won't make you change all other examples for the sake of consistency :P

Copy link
Member

Choose a reason for hiding this comment

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

I think you can use a private method for a new method.

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Mar 20, 2017
@jsamouh
Copy link
Contributor Author

jsamouh commented Mar 21, 2017

ping @nicolas-grekas . WDYT ? ^^

@dunglas
Copy link
Member

dunglas commented Mar 21, 2017

👍 (when the small comments will be fixed).

@jsamouh
Copy link
Contributor Author

jsamouh commented Mar 21, 2017

@dunglas , here it is :-)

@@ -465,6 +473,41 @@ public function testDecodeEmptyXml()
$this->encoder->decode(' ', 'xml');
}

private function getXmlPISource()
Copy link
Member

Choose a reason for hiding this comment

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

I would even get rid of this function and put the doc in testDecodeXMLWithProcessInstruction.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dunglas done

@fabpot
Copy link
Member

fabpot commented Mar 21, 2017

Thank you @jordscream.

@fabpot fabpot merged commit 0c741f5 into symfony:2.7 Mar 21, 2017
fabpot added a commit that referenced this pull request Mar 21, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] [XML] Ignore Process Instruction

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

This Pull request ignores Process instruction data in XML for decoding the data.

Commits
-------

0c741f5 [Serializer] [XML] Ignore Process Instruction
This was referenced Apr 4, 2017
sandergo90 pushed a commit to sandergo90/symfony that referenced this pull request Jul 4, 2019
…scream)

This PR was merged into the 2.7 branch.

Discussion
----------

[Serializer] [XML] Ignore Process Instruction

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

This Pull request ignores Process instruction data in XML for decoding the data.

Commits
-------

0c741f5 [Serializer] [XML] Ignore Process Instruction
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.

None yet

5 participants