Skip to content

Forbid serializing a Crawler #15906

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

Merged
merged 1 commit into from
Sep 27, 2015
Merged

Conversation

stof
Copy link
Member

@stof stof commented Sep 26, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

Unserializing a Crawler instance creates DOM elements in an invalid state, making the Crawler unusable.
While working on #15849, I figured out that DomCrawler actually inherits Serializable from its SplObjectStorage parent, and so I tried to serialize and unserialize one. The answer is that it does not work. This is what happens when trying to call parents on it for instance:

Symfony\Component\DomCrawler\Crawler::parents(): Invalid State Error

Unserializing a Crawler instance creates DOM elements in an invalid
state, making the Crawler unusable.
@Tobion
Copy link
Contributor

Tobion commented Sep 26, 2015

👍

Status: Reviewed

@fabpot
Copy link
Member

fabpot commented Sep 27, 2015

Thank you @stof.

@fabpot fabpot merged commit 12733cb into symfony:2.3 Sep 27, 2015
fabpot added a commit that referenced this pull request Sep 27, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Forbid serializing a Crawler

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

Unserializing a Crawler instance creates DOM elements in an invalid state, making the Crawler unusable.
While working on #15849, I figured out that DomCrawler actually inherits ``Serializable`` from its ``SplObjectStorage`` parent, and so I tried to serialize and unserialize one. The answer is that it does not work. This is what happens when trying to call ``parents`` on it for instance:

```
Symfony\Component\DomCrawler\Crawler::parents(): Invalid State Error
```

Commits
-------

12733cb Forbid serializing a Crawler
@stof stof deleted the forbid_serializing_crawler branch September 27, 2015 13:13
This was referenced Oct 27, 2015
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.

4 participants