Possible patch for explicit doctype error message


Another minor error message:

When validating a page with a user selected Doctype (eg 
doctype=XHTML+1.0+Strict), the validator produces an error message 
(either to Apache's error log or standard error):

check: Use of uninitialized value in hash element at 
line 1638.
check: Use of uninitialized value in string eq at 
line 1638.

The following patch suppresses the error, but maybe there is a better 
way to fix this? The issue is that when override_doctype() is first 
called (line 628), $File->{DOCTYPE} hasn't been set yet. Possibly 
$File->{DOCTYPE} should be initialized to '' earlier in the script? 
Or something else?

Thanks - Chuck

Index: httpd/cgi-bin/check
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.576
diff -u -r1.576 check
--- httpd/cgi-bin/check 19 Oct 2007 19:37:39 -0000      1.576
+++ httpd/cgi-bin/check 24 Oct 2007 19:48:14 -0000
@@ -1636,7 +1636,7 @@
    $File->{Content} = [split /\n/, $HTML];

    if ($seen) {
-    unless (($File->{Opt}->{FB}->{DOCTYPE}) or 
($File->{Opt}->{DOCTYPE} eq 
$CFG->{Types}->{$File->{DOCTYPE}}->{Display} )) {
+    unless (($File->{Opt}->{FB}->{DOCTYPE}) or (defined 
$File->{DOCTYPE} and ($File->{Opt}->{DOCTYPE} eq 
$CFG->{Types}->{$File->{DOCTYPE}}->{Display}) )) {
        &add_warning('W13', {
          W13_org => $org_dtd,
          W13_new => $File->{Opt}->{DOCTYPE},

Received on Wednesday, 24 October 2007 22:02:50 UTC