Skip to content

Commit e939376

Browse files
author
André L F S Bacci
committed
Trying get better error messages
1 parent b38eb1f commit e939376

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

configure.php

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121

2222
error_reporting(-1);
23+
ob_implicit_flush();
2324
$cvs_id = '$Id$';
2425

2526
echo "configure.php: $cvs_id\n";
@@ -757,22 +758,37 @@ function getFileModificationHistory(): array {
757758
checking('whether to save an invalid .manual.xml');
758759
checkvalue($ac['FORCE_DOM_SAVE']);
759760

760-
echo "Loading and parsing {$ac["INPUT_FILENAME"]}... ";
761-
flush();
762-
763761
$dom = new DOMDocument();
764762

765-
// realpath() is important: omitting it causes severe performance degradation
766-
// and doubled memory usage on Windows.
767-
$didLoad = $dom->load(realpath("{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}"), $LIBXML_OPTS);
763+
function dom_load( DOMDocument $dom , string $filename ) : bool
764+
{
765+
global $LIBXML_OPTS;
766+
$filename = realpath( $filename );
767+
return $dom->load( $filename , $LIBXML_OPTS );
768+
}
769+
770+
function dom_save( DOMDocument $dom , string $filename )
771+
{
772+
$dom->save( $filename );
773+
}
774+
775+
function dom_saveload( DOMDocument $dom , string $filename )
776+
{
777+
dom_save( $dom , $filename );
778+
dom_load( $dom , $filename );
779+
}
768780

769-
// Check if the XML was simply broken, if so then just bail out
770-
if ($didLoad === false) {
781+
echo "Loading and parsing {$ac["INPUT_FILENAME"]}... ";
782+
783+
if ( ! dom_load( $dom , "{$ac['srcdir']}/{$ac["INPUT_FILENAME"]}" ) )
784+
{
771785
echo "failed.\n";
772786
print_xml_errors();
773787
errors_are_bad(1);
774788
}
775-
echo "done.\n";
789+
else
790+
echo "done.\n";
791+
776792

777793
echo "Running XInclude/XPointer... ";
778794

@@ -845,8 +861,13 @@ function xinclude_run_xpointer( DOMDocument $dom ) : int
845861
{
846862
echo "$run ";
847863
$status = (int) $dom->xinclude();
864+
865+
xinclude_report(); die(x);
866+
848867
if ( $status <= 0 )
868+
{
849869
return $total;
870+
}
850871
$total += $status;
851872
libxml_clear_errors();
852873
}

0 commit comments

Comments
 (0)