Tk Library Source Code

View Ticket
Login
Ticket UUID: 3504018
Title: callback command gets called with varying arguments
Type: Bug Version: None
Submitter: dvrsn Created on: 2012-03-14 02:50:25
Subsystem: htmlparse Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2012-03-14 23:47:27
Resolution: Duplicate Closed By: dvrsn
    Closed on: 2012-03-14 16:47:27
Description:
Another problem related to badly formed html, here I think the problem is an open tag inside an attribute value, combined with a xhtml-style null end tag.

%  htmlparse::parse {<img src="x<y" /> <i></i>}
==> hmstart {} {} {}
==> img {} src=\"x
==> y\" {} {} {}
==> img / {} { <i} {}
==> i / {} {}
==> hmstart / {} {}

The html is malformed, so parsing is a guessing game, but the parser should try to be as resilient as possible.  What happens in this case is that the callback command, documented as always being called with 4 arguments, is called with 3 and 5 arguments.  This causes an error if your callback command has formal arguments instead of "args".
User Comments: dvrsn added on 2012-03-14 23:47:27:

allow_comments - 1

After some investigation and thought, this is a duplicate of 2941841