diff --git a/scripts/broken.php b/scripts/broken.php index 82b0d1cda1..d52c866080 100644 --- a/scripts/broken.php +++ b/scripts/broken.php @@ -20,7 +20,7 @@ the test is applied in all .xml files in directory and sub directories. This tool also cares for directories marked with .xmlfragmentdir, so -theses files are tested in relaxed semantics for XML fragments. */ +theses files are tested in relaxed semantics for XML Fragments. */ ini_set( 'display_errors' , 1 ); ini_set( 'display_startup_errors' , 1 ); @@ -78,6 +78,24 @@ function setup( string & $prefix , string & $suffix , string & $extra ) function testFile( string $filename , bool $fragment = false ) { + $contents = file_get_contents( $filename ); + + if ( str_starts_with( $contents , b"\xEF\xBB\xBF" ) ) + { + echo "Wrong XML file:\n"; + echo " Path: $filename\n"; + echo " Error: XML file with BOM. Several tools may misbehave.\n"; + echo "\n"; + } + + if ( PHP_EOL == "\n" && str_contains( $contents , "\r") ) + { + echo "Wrong XML file:\n"; + echo " Path: $filename\n"; + echo " Error: XML file contains \\r. Several tools may misbehave.\n"; + echo "\n"; + } + static $prefix = "", $suffix = "", $extra = ""; if ( $extra == "" ) setup( $prefix , $suffix , $extra ); @@ -88,7 +106,6 @@ function testFile( string $filename , bool $fragment = false ) $doc->substituteEntities = false; libxml_use_internal_errors( true ); - $contents = file_get_contents( $filename ); if ( $fragment ) $contents = "{$contents}"; $doc->loadXML( $contents ); diff --git a/scripts/file-entities.php b/scripts/file-entities.php index 7220c97415..adf1494744 100644 --- a/scripts/file-entities.php +++ b/scripts/file-entities.php @@ -147,16 +147,33 @@ function pushEntity( string $name , string $text = '' , string $path = '' ) $lname = strtolower( $name ); if ( isset( $mixedCase[ $lname ] ) && $mixedCase[ $lname ] != $name ) { - echo "\n\n"; - echo "BROKEN BUILD on case insensitive file systems!\n"; - echo "Detected distinct file entities only by case:\n"; - echo " - {$mixedCase[ $lname ]}\n"; - echo " - $name \n"; - echo "This will PERMANENTLY BRICK manual build on Windows machines!\n"; - echo "Avoid committing this on repository, and if it's already committed,\n"; - echo "revert and send a heads up on mailinst how to fix the issue.\n\n"; - echo "See https://github.com/php/doc-en/pull/4330#issuecomment-2557306828"; - echo "\n\n"; + echo <<