File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed
_files/AtomStandaloneEntry/content Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,9 @@ public static function importString($string)
363363 $ disableEntityLoaderFlag = self ::disableEntityLoader ();
364364 $ dom = new DOMDocument ();
365365 $ status = $ dom ->loadXML (trim ($ string ));
366+ if ($ dom ->encoding === null ) {
367+ $ dom ->encoding = 'UTF-8 ' ;
368+ }
366369 foreach ($ dom ->childNodes as $ child ) {
367370 if ($ child ->nodeType === XML_DOCUMENT_TYPE_NODE ) {
368371 throw new Exception \InvalidArgumentException (
Original file line number Diff line number Diff line change @@ -249,6 +249,20 @@ public function testGetsContentFromAtom10XhtmlNamespaced(): void
249249 $ this ->assertEquals ('<p class="x:"><em>Entry Content &x:</em></p> ' , $ entry ->getContent ());
250250 }
251251
252+ /**
253+ * XHTML document does not have encoding
254+ *
255+ * @group LaminasRATOMCONTENT
256+ */
257+ public function testGetsContentFromAtom10XhtmlNamespacedNoEncoding (): void
258+ {
259+ $ entry = Reader \Reader::importString (
260+ file_get_contents ($ this ->feedSamplePath . '/content/atom10_XhtmlNoEncoding.xml ' )
261+ );
262+ $ this ->assertInstanceOf (Atom::class, $ entry );
263+ $ this ->assertEquals ('<p class="x:"><em>Entry Content &x:</em></p> ' , $ entry ->getContent ());
264+ }
265+
252266 /**
253267 * Get Link (Unencoded Text)
254268 *
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <entry xmlns =" http://www.w3.org/2005/Atom" >
3+ <content type =" xhtml" xmlns : x =" http://www.w3.org/1999/xhtml" >
4+ <x : div >
5+ <x : p class =" x:" ><x : em >Entry Content & x:</x : em ></x : p >
6+ </x : div >
7+ </content >
8+ </entry >
You can’t perform that action at this time.
0 commit comments