Skip to content

Commit

Permalink
Remove quote escaping from string serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospassos committed Jul 13, 2017
1 parent afdab89 commit 7a78b61
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
There are currently no unreleased changes.

## [0.5.2](https://github.com/marcospassos/java-php-serializer/releases/tag/0.5.2) (2017-07-12)

### Changed

- Remove unnecessary quote escaping from string serialization.


## [0.5.1](https://github.com/marcospassos/java-php-serializer/releases/tag/0.5.1) (2017-07-09)

### Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ to the `dependencies` section of its `pom.xml` file:
<dependency>
<groupId>com.marcospassos</groupId>
<artifactId>phpserializer</artifactId>
<version>0.5.1</version>
<version>0.5.2</version>
</dependency>
</dependencies>
```
Expand Down Expand Up @@ -227,8 +227,8 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
```

[maven-central-badge]: https://img.shields.io/badge/maven%20central-v0.5.1-blue.svg
[maven-central-latest]: http://search.maven.org/#artifactdetails%7Ccom.marcospassos%7Cphpserializer%7C0.5.1%7Cjar
[maven-central-badge]: https://img.shields.io/badge/maven%20central-v0.5.2-blue.svg
[maven-central-latest]: http://search.maven.org/#artifactdetails%7Ccom.marcospassos%7Cphpserializer%7C0.5.2%7Cjar
[coverall-status]: https://coveralls.io/github/marcospassos/java-php-serializer
[coverall-badge]: https://coveralls.io/repos/github/marcospassos/java-php-serializer/badge.svg
[travis-badge]: https://travis-ci.org/marcospassos/java-php-serializer.svg?branch=master
Expand All @@ -243,4 +243,4 @@ DEALINGS IN THE SOFTWARE.
[issue-tracker]: https://github.com/marcospassos/java-php-serializer/issues
[repository]: https://github.com/marcospassos/java-php-serializer
[releases-page]: https://github.com/marcospassos/java-php-serializer/releases
[latest-release]: https://github.com/marcospassos/java-php-serializer/releases/tag/0.5.1
[latest-release]: https://github.com/marcospassos/java-php-serializer/releases/tag/0.5.2
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.marcospassos</groupId>
<artifactId>phpserializer</artifactId>
<version>0.5.1-SNAPSHOT</version>
<version>0.5.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Java PHP Serializer</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/marcospassos/phpserializer/Writer.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public void writeString(String value)
buffer.append("s:");
buffer.append(value.length());
buffer.append(":\"");
buffer.append(value.replaceAll("\"", "\\\\\""));
buffer.append(value);
buffer.append("\";");
}

Expand Down
9 changes: 9 additions & 0 deletions src/test/java/com/marcospassos/phpserializer/WriterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ public void writeString() throws Exception
assertEquals("s:3:\"foo\";", writer.getResult());
}

@Test
public void writeStringDoesNotEscapeQuotes() throws Exception
{
Writer writer = new Writer();
writer.writeString("\"foo\"");

assertEquals("s:5:\"\"foo\"\";", writer.getResult());
}

@Test
public void writeEmptyString() throws Exception
{
Expand Down

0 comments on commit 7a78b61

Please sign in to comment.