diff options
Diffstat (limited to 'httpd/cgi-bin/check')
-rwxr-xr-x | httpd/cgi-bin/check | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/httpd/cgi-bin/check b/httpd/cgi-bin/check index 5e8a4bb..89d2b66 100755 --- a/httpd/cgi-bin/check +++ b/httpd/cgi-bin/check @@ -1331,6 +1331,25 @@ sub xmlwf (\$) $err->{type} = "E"; $err->{msg} = $err_obj->message(); + # Ugly workaround for XML::LibXML reporting column 80 when the + # error occurs beyond that: + # http://rt.cpan.org/Public/Bug/Display.html?id=66642 + if ($err->{char} && $err->{char} == 80 && + # This workaround does not apply to non-document errors, i.e. + # ones that have $err->{uri}. + !$err->{uri} && $err->{line}) + { + # Get context reported by XML::LibXML, ... + my $ctx = $err_obj->context(); + if ($ctx && length($ctx) == $err->{char}) { + # ... try to locate it in our original source line, ... + my $line = $File->{Content}->[$err->{line}-1] || ''; + my $ix = index($line, $ctx); + # ... and adjust column offset accordingly. + $err->{char} += $ix if $ix > 0; + } + } + $err_obj = $err_obj->_prev(); unshift(@{$File->{WF_Errors}}, $err); |