[DOC-CVS] [doc-base] master: Fix incomplete entity reference work around. (#323)

[email protected] (alfsb via GitHub) Fri, 24 Jul 2026 13:00:26 +0000
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: alfsb (alfsb)
Committer: GitHub (web-flow)
Pusher: alfsb
Date: 2026-07-24T10:00:24-03:00

Commit: https://github.com/php/doc-base/commit/982980a58b8b05b5cbdb832aa426a5b29df77a46
Raw diff: https://github.com/php/doc-base/commit/982980a58b8b05b5cbdb832aa426a5b29df77a46.diff

Fix incomplete entity reference work around. (#323)

Changed paths:
  M  scripts/text-entities.php


Diff:

diff --git a/scripts/text-entities.php b/scripts/text-entities.php
index a1306dbd3c..19bfea8d03 100644
--- a/scripts/text-entities.php
+++ b/scripts/text-entities.php
@@ -329,7 +329,7 @@ function loadEntityGroup( string $path )
 {
     $path = realpath( $path );
     $text = file_get_contents( $path );
-    $text = str_replace( "&" , "&amp;" , $text );
+    $text = str_replace( '&' , '&amp;' , $text );
 
     $dom = new DOMDocument( '1.0' , 'utf8' );
     if ( ! $dom->loadXML( $text ) )
@@ -371,6 +371,7 @@ function loadEntityGroup( string $path )
         $text = "";
         foreach( $other->childNodes as $node )
             $text .= $other->saveXML( $node );
+        $text = str_replace( '&amp;' , '&' , $text );
 
         Entities::put( $path , $name , $text , $unique , $remove );
     }