armen5518 / phpquery

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

phpQuery breaks with a mixture of scripting tags in php file #226

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the following php script (where $file['path'] is a local path to the 
file to be manipulated):
$doc = phpQuery::newDocumentFilePHP($file['path']);
print_r(pq('.item1')->length);

2. On the attched file: 
'ibreakit.php'

What is the expected output? What do you see instead?
the expected output would be 2 as there are two html elements with class 
'item1'. Instead You will get 0.

What version of the product are you using? On what operating system?
I downloaded the latest version to try phpQuery yesterday.

Please provide any additional information below.
I narrowed things down a little bit. In the second file 'idontbreakit.php' I 
simply remove the type attribute on the script tag and magically the php script 
returns 2 as expected.
But then a strange thing.. I can put the type attribute back into the script 
tag but place the php tag after the script tag and again it magically return 2 
as expected.

if you then go ahead and print $doc when on the 'ibreakit.php' file you see the 
file has lost content and that the classes I was originally looking for are not 
actually there:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Contact us all at the same time...
Thank you for contacting us, we will get back to you as soon as possible.
Contact us individually...
  • Name
  • Number (optional) <?php?>text/javascript">

but of course on any of the others (idontbreak files) their $doc is complete... 
but with one issue.. the <?php ?> is converted into <php></php>... I have never 
even seen this type of tag before.

Original issue reported on code.google.com by johncarm...@gmail.com on 22 Mar 2013 at 12:53

Attachments: