Skip to content

Commit ddbe0d3

Browse files
author
André L F S Bacci
committed
Avoid duplicated reports (also fix CI)
1 parent a153861 commit ddbe0d3

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

configure.php

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
| Authors: Dave Barr <[email protected]> |
1717
| Hannes Magnusson <[email protected]> |
1818
| Gwynne Raskind <[email protected]> |
19+
| André L F S Bacci <[email protected]> |
1920
+----------------------------------------------------------------------+
2021
*/
2122

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

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

783-
if ( ! dom_load( $dom , "{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}" ) )
784+
if ( dom_load( $dom , "{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}" ) )
784785
{
785-
echo "failed.\n";
786-
print_xml_errors();
787-
errors_are_bad(1);
786+
if ( ! file_exists( __DIR__ . "/temp" ) )
787+
mkdir( __DIR__ . "/temp" , true ); //TODO remove after #200, aldo clean up flush(), header
788+
789+
// Correct file/line/column on error messages
790+
dom_saveload( $dom , __DIR__ . "/temp/manual.xml" );
791+
echo "done.\n";
788792
}
789793
else
790794
{
791-
// So that file/line/column makes sense on error messages
792-
dom_saveload( $dom , __DIR__ . "/temp/manual.xml" );
793-
echo "done.\n";
795+
echo "failed.\n";
796+
print_xml_errors();
797+
errors_are_bad(1);
794798
}
795799

796800
echo "Running XInclude/XPointer... ";
@@ -893,13 +897,21 @@ function xinclude_report()
893897
$count = 0;
894898
$prefix = realpath( __DIR__ );
895899

900+
$prevLine = -1;
901+
$prevClmn = -1;
902+
896903
foreach( $errors as $error )
897904
{
898905
$msg = $error->message;
899906
$file = $error->file;
900907
$line = $error->line;
901908
$clmn = $error->column;
902909

910+
if ( $prevLine == $line && $prevClmn == $clmn )
911+
continue; // XPointer failures double reports sometimes
912+
$prevLine = $line;
913+
$prevClmn = $clmn;
914+
903915
$msg = rtrim( $msg );
904916
if ( str_starts_with( $file , $prefix ) )
905917
$file = substr( $file , strlen( $prefix ) + 1 );

0 commit comments

Comments
 (0)