[DOC-CVS] [doc-base] master: compromise on validation (#284)

[email protected] (Kamil Tekiela via GitHub) Wed, 29 Apr 2026 12:34:46 +0000
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Kamil Tekiela (kamil-tekiela)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2026-04-29T13:34:42+01:00

Commit: https://github.com/php/doc-base/commit/81d0ed53cc780eddf18906c42e673bd9ea63039b
Raw diff: https://github.com/php/doc-base/commit/81d0ed53cc780eddf18906c42e673bd9ea63039b.diff

compromise on validation (#284)

Changed paths:
  M  configure.php


Diff:

diff --git a/configure.php b/configure.php
index 762a0ca966..815e454ade 100755
--- a/configure.php
+++ b/configure.php
@@ -65,8 +65,6 @@ function usage() // {{{
                                  [{$acd['ROOTDIR']}]
 
 Package-specific:
-  --enable-force-dom-save        Force .manual.xml to be saved in a full build
-                                 even if it fails validation [{$acd['FORCE_DOM_SAVE']}]
   --enable-chm                   Enable Windows HTML Help Edition pages [{$acd['CHMENABLED']}]
   --enable-xml-details           Enable detailed XML error messages [{$acd['DETAILED_ERRORMSG']}]
   --disable-version-files        Do not merge the extension specific
@@ -304,7 +302,6 @@ function find_xml_files($path) // {{{
     'LANG' => 'en',
     'LANGDIR' => "{$rootdir}/en",
     'ENCODING' => 'utf-8',
-    'FORCE_DOM_SAVE' => 'no',
     'PARTIAL' => 'no',
     'DETAILED_ERRORMSG' => 'no',
     'VERSION_FILES'  => 'yes',
@@ -377,10 +374,6 @@ function find_xml_files($path) // {{{
             $ac['srcdir'] = $v;
             break;
 
-        case 'force-dom-save':
-            $ac['FORCE_DOM_SAVE'] = $v;
-            break;
-
         case 'chm':
             $ac['CHMENABLED'] = $v;
             break;
@@ -637,13 +630,9 @@ function xml_configure()
     $ac["GENERATE"] = str_replace($ac["ROOTDIR"].$ac["LANGDIR"], "", $tmp);
     $str = "\n<!ENTITY developer.include.file SYSTEM 'file:///{$ac["GENERATE"]}'>";
     file_put_contents("{$ac["basedir"]}/entities/file-entities.ent", $str, FILE_APPEND);
-    $ac["FORCE_DOM_SAVE"] = "yes";
 }
 checkvalue($ac["GENERATE"]);
 
-checking('whether to save an invalid .manual.xml');
-checkvalue($ac['FORCE_DOM_SAVE']);
-
 function dom_load( DOMDocument $dom , string $filename , string $baseURI = "" ) : bool
 {
     $filename = realpath( $filename );
@@ -951,27 +940,25 @@ function xinclude_residual_list( DOMDocument $dom ) : DOMNodeList
     echo "done.\n";
 } else {
     echo "failed.\n";
-    echo "\nThe document didn't validate\n";
-
-    /**
-     * TODO: Integrate jing to explain schema violations as libxml is *useless*
-     * And this is not going to change for a while as the maintainer of libxml2 even acknowledges:
-     * > As it stands, libxml2's Relax NG validator doesn't seem suitable for production.
-     * cf. https://gitlab.gnome.org/GNOME/libxml2/-/issues/448
-     */
-    $output = shell_exec('java -jar ' . $srcdir . '/docbook/jing.jar ' . RNG_SCHEMA_FILE. ' ' . $acd['OUTPUT_FILENAME']);
-    if ($output === null) {
-        echo "Command failed do you have Java installed?";
+    echo "\nThe document didn't validate.\n";
+
+    if ($ac['DETAILED_ERRORMSG'] === 'yes') {
+        /**
+         * TODO: Integrate jing to explain schema violations as libxml is *useless*
+         * And this is not going to change for a while as the maintainer of libxml2 even acknowledges:
+         * > As it stands, libxml2's Relax NG validator doesn't seem suitable for production.
+         * cf. https://gitlab.gnome.org/GNOME/libxml2/-/issues/448
+         */
+        $output = shell_exec('java -jar ' . $srcdir . '/docbook/jing.jar ' . RNG_SCHEMA_FILE. ' ' . $acd['OUTPUT_FILENAME']);
+        if ($output === null) {
+            echo "Command failed do you have Java installed?";
+        } else {
+            echo $output;
+        }
     } else {
-        echo $output;
-    }
-    //echo 'Please use Jing and the:' . PHP_EOL
-    //    . 'java -jar ./build/jing.jar /path/to/doc-base/docbook/docbook-v5.2-os/rng/docbookxi.rng /path/to/doc-base/.manual.xml' . PHP_EOL
-    //    . 'command to check why the RelaxNG schema failed.' . PHP_EOL;
-
-    // Exit normally when don't care about validation
-    if ($ac["FORCE_DOM_SAVE"] == "yes") {
-        exit(0);
+        echo "Here are the errors I got:\n";
+        echo "(If this isn't enough information, try again with --enable-xml-details)\n";
+        print_xml_errors(false);
     }
 
     errors_are_bad(1); // Tell the shell that this script finished with an error.