From:             queen dot zeal at gmail dot com
Operating system: 
PHP version:      5.2.8
PHP Bug Type:     DOM XML related
Bug description:  DOMDocument's inferior parsing of malformed HTML

Description:
------------
I'm trying to get a list of all the input elements of a form tag and
am having some difficulty doing so due to a PHP bug.  First, here's my
XHTML:

<div>
    <form action="">
    <input type="text" name="a" />
</div>
<div>
    <input type="text" name="b" />
</div>
<div>
    <input type="submit" />
    </form>
</div>

It isn't semantically correct XHTML but that doesn't stop web
developers from coding like that.

Anyway, in both Firefox and IE, if you visit a webpage containing the
above, and hit the Submit button, the resultant URL will have both a
and b defined via GET.

I'd like to be able to get a list of the same input parameters that
the browser does for a given form element.  I had been using "//
form[1]//input" as an XPath query, but that doesn't work, here,
because not all of the inputs are children of the form element.
Indeed, if I use DOMDocument::saveHTML(), I get something more like
this:

<div>
    <form action="">
    <input type="text" name="a" />
    </form>
</div>
<div>
    <input type="text" name="b" />
</div>
<div>
    <input type="submit" />
</div>

Before you go off and pass the buck to the libxml developers, without even
reviewing this, consider, first, that it might not be a bug in libxml, but
rather, with PHP's bindings to libxml.

Further, if you're going to be pass the buck, do so, yourself.  I don't
know C or C++ or whatever language libxml was originally intended to be
used with.  Since I don't know C / C++, if I were to file a bug report with
the libxml developers, it'd have to be in PHP, which they may or may not
know, themselves.  As such, it wouldn't be a very useful bug report,
whereas if the person who implemented the libxml bindings for PHP filed it,
they could make it a whole lot more useful.

Maybe a good fix for PHP (that wouldn't involve the libxml people) would
be to use a different XML parsing engine.  Maybe use the HTML rendering
engine that Firefox uses - Gecko.


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

Reply via email to