Skip to content

Commit

Permalink
Avoid duplicated reports (also fix CI)
Browse files Browse the repository at this point in the history
  • Loading branch information
André L F S Bacci committed Dec 6, 2024
1 parent a153861 commit ddbe0d3
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
| Authors: Dave Barr <[email protected]> |
| Hannes Magnusson <[email protected]> |
| Gwynne Raskind <[email protected]> |
| André L F S Bacci <[email protected]> |
+----------------------------------------------------------------------+
*/

Expand Down Expand Up @@ -780,17 +781,20 @@ function dom_saveload( DOMDocument $dom , string $filename )

echo "Loading and parsing {$ac["INPUT_FILENAME"]}... ";

if ( ! dom_load( $dom , "{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}" ) )
if ( dom_load( $dom , "{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}" ) )
{
echo "failed.\n";
print_xml_errors();
errors_are_bad(1);
if ( ! file_exists( __DIR__ . "/temp" ) )
mkdir( __DIR__ . "/temp" , true ); //TODO remove after #200, aldo clean up flush(), header

// Correct file/line/column on error messages
dom_saveload( $dom , __DIR__ . "/temp/manual.xml" );
echo "done.\n";
}
else
{
// So that file/line/column makes sense on error messages
dom_saveload( $dom , __DIR__ . "/temp/manual.xml" );
echo "done.\n";
echo "failed.\n";
print_xml_errors();
errors_are_bad(1);
}

echo "Running XInclude/XPointer... ";
Expand Down Expand Up @@ -893,13 +897,21 @@ function xinclude_report()
$count = 0;
$prefix = realpath( __DIR__ );

$prevLine = -1;
$prevClmn = -1;

foreach( $errors as $error )
{
$msg = $error->message;
$file = $error->file;
$line = $error->line;
$clmn = $error->column;

if ( $prevLine == $line && $prevClmn == $clmn )
continue; // XPointer failures double reports sometimes
$prevLine = $line;
$prevClmn = $clmn;

$msg = rtrim( $msg );
if ( str_starts_with( $file , $prefix ) )
$file = substr( $file , strlen( $prefix ) + 1 );
Expand Down

0 comments on commit ddbe0d3

Please sign in to comment.