Re: undefined value as ARRAY error

On Feb 20, 2008, at 2:19 AM, olivier Thereaux wrote:
> Hi Ryan,
> Thanks for sending this bug report.
>
> On Feb 14, 2008, at 06:59 , Ryan King wrote:
>> I'm checking http://www.kyleandkelly.com/ via the soap interface.  
>> I'm actually downloading the html, then posting it to the  
>> validator. I can try and find a way to reproduce the error without  
>> my application, if that helps.
>
> Yes, finding a way to reproduce without the app, or letting us see  
> the way your app sends data to the validator, would be helpful.
>
> What may also help, as Ville suggested, is to try and run against  
> the dev version of the validator:
> http://qa-dev.w3.org/wmvs/HEAD/
> And tell us which line the error gets reported at (if at all).

There's a ruby script at the end of this email the reproduces the  
problem. It uses the w3c_validators gem[http://code.dunae.ca/w3c_validators/ 
].

Here's the response I get from validator.w3.org (as seen by tcpflow):
----
HTTP/1.1 200 OK
Date: Wed, 20 Feb 2008 20:27:53 GMT
Server: Apache/2.2.3 (Debian)
Transfer-Encoding: chunked
Content-Type: text/html

163
<h1>Software error:</h1>
<pre>Can't use an undefined value as an ARRAY reference at /usr/local/ 
validator/httpd/cgi-bin/check line 1919, &lt;fh00001temp.html&gt; line  
1.
</pre>
<p>
For help, please send mail to the webmaster (<a href="mailto:[no  
address given]">[no address given]</a>), giving this error message
and the time and date of the error.

</p>
----

Interestingly, when I point it at the dev version, I don't get the  
error.

I hope this helps.

-ryan


#!/usr/bin/env ruby -KU

require 'rubygems'
require 'w3c_validators'
require 'stringio'

# MONKEYPATCH
module W3CValidators
class MarkupValidator
   def validate_file(file)
     if file.respond_to? :read
       src = file.read
     else
       src = read_local_file(file)
     end
     return validate({:uploaded_file => src}, false)
   end
end
end

# v = W3CValidators::MarkupValidator.new :validator_uri => 'http://qa-dev.w3.org/wmvs/HEAD/'
v = W3CValidators::MarkupValidator.new

u = URI.parse('http://www.kyleandkelly.com/')

response = Net::HTTP.start(u.host, u.port) do |h|
   h.get u.request_uri
end

if response.type_params.key? 'charset'
   charset = response.type_params['charset']
   v.set_charset!(charset)
else
   charset = nil
end

result = v.validate_file StringIO.new(response.body)

Received on Wednesday, 20 February 2008 20:34:05 UTC