Ericcom / phpquery

Automatically exported from code.google.com/p/phpquery
1 stars 0 forks source link

object can't be cloned by php's "clone" #195

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. $doc1 = phpQuery::newDocumentHTML('<h1>hello world</h1>', 'utf-8')
2. $doc2 = clone $doc1;
3. then modifiyng $doc2 will modify doc1 too... 

What is the expected output? What do you see instead?
$doc2 modified and $doc1 untouched

What version of the product are you using? On what operating system?
0.9.5 (one single file) on windows 7

Please provide any additional information below.
As a workaround I did the following:
$doc2 = phpQuery::newDocumentHTML($doc1, 'utf-8');

I guess you could define the magic method __clone to change the phpQueryObject 
id.

Original issue reported on code.google.com by knif...@gmail.com on 20 Sep 2011 at 3:21