Forbid serializing a Crawler

Unserializing a Crawler instance creates DOM elements in an invalid
state, making the Crawler unusable.
This commit is contained in:
Christophe Coevoet 2015-09-26 12:01:36 +02:00
parent 7a142fd17b
commit 12733cba00

View File

@ -311,6 +311,17 @@ class Crawler extends \SplObjectStorage
} }
} }
// 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. * Returns a node given its position in the node list.
* *