From:             taylorms at mtaonline dot net
Operating system: Linux
PHP version:      5.3SVN-2009-09-23 (snap)
PHP Bug Type:     DOM XML related
Bug description:  DOM LoadHTMLfile error

Description:
------------
The line of HTML below causes DOM LoadHTMLfile to throw the following
exception:

DOMDocument::loadHTMLFile() [<a
href='function.DOMDocument-loadHTMLFile'>function.DOMDocument-loadHTMLFile</a>]:
htmlParseEntityRef: expecting ';' in contactus.html, line: 111

Line 111 of contactus.html is a link with an onclick with multiline (";"
separated) embedded javascript. The source line is shown in the code
section. Note that if I create a javascript function, and reference only
the function name in the 'onclick=""', the error is NOT produced (also
shown). It appears the parser is getting confused with the embedded
javascript in this statement.



Reproduce code:
---------------
---
>From manual page: domdocument.loadhtmlfile
---

HTML Source that causes error:

<a class="social_buttons"
href="http://www.facebook.com/share.php?u=aboutfaceak.com";
onclick="u=location.href;t=document.title;window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return
false;" target="_blank"><img class="social_img"
src="../images/facebook_share.png" /></a>

The following code with a change to "onclick" does NOT cause an error:

<a class="social_buttons"
href="http://www.facebook.com/share.php?u=aboutfaceak.com"; ONCLICK="RETURN
FBSHARE();" target="_blank"><img class="social_img"
src="../images/facebook_share.png" /></a>



Expected result:
----------------
The onclick javascript code opens a new window with a facebook php app
that uses the URL of the page where the link was clicked as the link to
share on facebook. If javascript is disabled, the generic link listed in
"href" is used instead of the actual current page URL.

Actual result:
--------------
The error shown in the description is thrown (and caught/logged) when the
loadHTMLfile function is called with the source file containing the above
source line.

-- 
Edit bug report at http://bugs.php.net/?id=49646&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=49646&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=49646&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=49646&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=49646&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49646&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=49646&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=49646&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=49646&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=49646&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=49646&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=49646&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=49646&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=49646&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=49646&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49646&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49646&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=49646&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=49646&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=49646&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=49646&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=49646&r=mysqlcfg

Reply via email to