10000 Forbid serializing a Crawler by stof · Pull Request #15906 · symfony/symfony · GitHub
[go: up one dir, main page]

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Forbid serializing a Crawler
Unserializing a Crawler instance creates DOM elements in an invalid
state, making the Crawler unusable.
  • Loading branch information
stof committed Sep 26, 2015
commit 12733cba00a0aa06f1458f28b80e24ccb7ec6841
11 changes: 11 additions & 0 deletions src/Symfony/Component/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,17 @@ public function addNode(\DOMNode $node)
}
}

// Serializing and unserializing a crawler creates DOM objects in a corrupted state. DOM elements are not properly serializable.
public function unserialize($serialized)
{
throw new \BadMethodCallException('A Crawler cannot be serialized.');
}

public function serialize()
{
throw new \BadMethodCallException('A Crawler cannot be serialized.');
}

/**
* Returns a node given its position in the node list.
*
Expand Down
0