@@ -69,29 +69,14 @@ public static function schemaValidate(Dom\Document $document, ?string $schemaFil
6969 throw new SchemaViolationException ('Could not serialize XML root for schema validation. ' );
7070 }
7171
72- // 1) Legacy validation (authoritative for now)
73- $ legacyResult = self ::schemaValidateWithLegacyDom ($ xmlRoot , $ schemaFile );
74-
75- if ($ legacyResult ['ok ' ] === false ) {
72+ $ domResult = self ::schemaValidateWithDomDocument ($ document , $ schemaFile );
73+ if ($ domResult ['ok ' ] === false ) {
7674 throw new SchemaViolationException (sprintf (
7775 "XML schema validation errors: \n - %s " ,
78- implode ("\n - " , $ legacyResult ['errors ' ] ?: ['no libxml errors reported ' ]),
76+ implode ("\n - " , $ domResult ['errors ' ] ?: ['no libxml errors reported ' ]),
7977 ));
8078 }
8179
82- // 2) New validation (temporarily disabled)
83- //
84- // NOTE: Dom\Document::schemaValidate() can produce false negatives in some cases.
85- // See: https://github.com/php/php-src/issues/22219
86- //
87- // $domResult = self::schemaValidateWithDomDocument($document, $schemaFile);
88- // if ($domResult['ok'] === false) {
89- // throw new SchemaViolationException(sprintf(
90- // "XML schema validation errors:\n - %s",
91- // implode("\n - ", $domResult['errors'] ?: ['no libxml errors reported']),
92- // ));
93- // }
94-
9580 return $ document ;
9681 } finally {
9782 libxml_clear_errors ();
0 commit comments