W3C home > Mailing lists > Public > www-validator@w3.org > October 2007

Possible patch for explicit doctype error message

From: Chuck Houpt <chuck@habilis.net>
Date: Wed, 24 Oct 2007 18:02:24 -0400
Message-Id: <a06240800c33c44ba7b63@[192.168.1.153]>
To: www-validator@w3.org

Hi,

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 
/Applications/Validator-SAC.app/Contents/Resources/validator/httpd/cgi-bin/check 
line 1638.
check: Use of uninitialized value in string eq at 
/Applications/Validator-SAC.app/Contents/Resources/validator/httpd/cgi-bin/check 
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:26 GMT