php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39409 loadhtml problem when html contains javascript that contain tag in string var
Submitted: 2006-11-07 03:30 UTC Modified: 2006-11-07 05:45 UTC
From: c00lways at gmail dot com Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.0 OS: windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: c00lways at gmail dot com
New email:
PHP Version: OS:

 

 [2006-11-07 03:30 UTC] c00lways at gmail dot com
Description:
------------
odd problem with javascript which contains tag within the string, example:

-----------
<html>
<body>
<script>
var xx;
xx = "<select name='aa' id='aa'></select>";
</sript>
</body>
</html>
------------

domdocumentobject->loadHTML( _the_string_above_ );

when saveHTML, will return ( missing </select> )
<html>
<body>
<script>
var xx;
xx = "<select name='aa' id='aa'>";
</sript>
</body>
</html>

it happens to all kind of close tag within the javascript.

i'm currently doing a workaround by joining the string instead of a direct close tag 

xx = "<select name='aa' id='aa'><" + "/select>";

please advice, thank you :)

best regards,

James


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-07 05:45 UTC] chregu@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The html parsing is done by libxml2, so you should complain 
there. Or just use

<!--  
var xx;
xx = "<select name='aa' id='aa'></select>";
//-->

like in the old days :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 22:01:27 2024 UTC