artlantis / phpquery

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

E_NOTICE error when parsing file without <head> tag #141

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Load template with <html> tag, but no <head> tag:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<body>
<div class="mydiv">
  <strong>Hi</strong>
</div>

</body>
</html>

2. Try to fetch class="mydiv" node.

$document = phpQuery::newDocumentFile('/path/to/file.html');
foreach ($document['.mydiv'] as $line) {
    exit;
}

3. xdebug stack trace generated:

( ! ) Notice: Undefined variable: hltml in 
/Applications/MAMP/htdocs/noah/lib/phpQuery/phpQuery/phpQuery/DOMDocumentWrapper
.p
hp on line 389
Call Stack
#   Time    Memory  Function    Location
1   0.0007  75316   {main}( )   ../index.php:0
2   0.0245  1549648 phpQuery::newDocumentFile( )    ../index.php:41
3   0.0246  1550236 phpQuery::createDocumentWrapper( )  ../phpQuery.php:408
4   0.0247  1552016 DOMDocumentWrapper->__construct( )  ../phpQuery.php:497
5   0.0247  1552380 DOMDocumentWrapper->load( ) ../DOMDocumentWrapper.php:49
6   0.0247  1553088 DOMDocumentWrapper->loadMarkup( )   
../DOMDocumentWrapper.php:63
7   0.0248  1554656 DOMDocumentWrapper->loadMarkupHTML( )   
../DOMDocumentWrapper.php:116
8   0.0250  1557976 DOMDocumentWrapper->charsetAppendToHTML( )  
../DOMDocumentWrapper.php:193

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.
Caused by a misspelled variable. Easy fix. Patch attached.

Original issue reported on code.google.com by johnk...@gmail.com on 21 Dec 2009 at 3:29

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Duplicated in 
Issue 147 
Issue 149 
Issue 152 
Issue 156 
Issue 157

Original comment by gene.wood.temp on 19 Oct 2010 at 6:33

GoogleCodeExporter commented 9 years ago
And duplicated over and over again in:
Issue 174
Issue 181
Issue 182
Issue 190

Original comment by knif...@gmail.com on 20 Sep 2011 at 3:27

GoogleCodeExporter commented 9 years ago
maybe duplicated issue but not yet corrected 3 years after...

Original comment by timothee...@gmail.com on 10 Jul 2013 at 10:23