Skip to content

Commit 23a50d1

Browse files
committed
Merge branch '4.4' into 5.3
* 4.4: (29 commits) fix: Improve FR validators translation Add swedish translation for issue #43458 [HttpClient] fix collecting debug info on destruction of CurlResponse Fix CS added missing thai translations Add missing translations for Chinese (zh_TW) [DependencyInjection] fix "url" env var processor update translation Remove untranslated translation for Afrikaans [Validator] Add missing validator polish translation [Security,Validator] Added missing Latvian translations #41053 Add the missing translations for Indonesian (id) [Validator] Add missing Lithuanian translation [Validator] Add missing Czech translation replace "ispravna" with "važeća" in translating "valid HTML/CSS" added missing translation for galician Add missing translation in Vietnamese Add missing translation in Bulgarian added missing translations for portuguese [#43450] Add missing validator slovak translation ...
2 parents b43c51f + 2a50705 commit 23a50d1

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

Caster/XmlReaderCaster.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ class XmlReaderCaster
4444

4545
public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, bool $isNested)
4646
{
47+
try {
48+
$properties = [
49+
'LOADDTD' => @$reader->getParserProperty(\XMLReader::LOADDTD),
50+
'DEFAULTATTRS' => @$reader->getParserProperty(\XMLReader::DEFAULTATTRS),
51+
'VALIDATE' => @$reader->getParserProperty(\XMLReader::VALIDATE),
52+
'SUBST_ENTITIES' => @$reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
53+
];
54+
} catch (\Error $e) {
55+
$properties = [
56+
'LOADDTD' => false,
57+
'DEFAULTATTRS' => false,
58+
'VALIDATE' => false,
59+
'SUBST_ENTITIES' => false,
60+
];
61+
}
62+
4763
$props = Caster::PREFIX_VIRTUAL.'parserProperties';
4864
$info = [
4965
'localName' => $reader->localName,
@@ -57,12 +73,7 @@ public static function castXmlReader(\XMLReader $reader, array $a, Stub $stub, b
5773
'value' => $reader->value,
5874
'namespaceURI' => $reader->namespaceURI,
5975
'baseURI' => $reader->baseURI ? new LinkStub($reader->baseURI) : $reader->baseURI,
60-
$props => [
61-
'LOADDTD' => $reader->getParserProperty(\XMLReader::LOADDTD),
62-
'DEFAULTATTRS' => $reader->getParserProperty(\XMLReader::DEFAULTATTRS),
63-
'VALIDATE' => $reader->getParserProperty(\XMLReader::VALIDATE),
64-
'SUBST_ENTITIES' => $reader->getParserProperty(\XMLReader::SUBST_ENTITIES),
65-
],
76+
$props => $properties,
6677
];
6778

6879
if ($info[$props] = Caster::filter($info[$props], Caster::EXCLUDE_EMPTY, [], $count)) {

Tests/Caster/XmlReaderCasterTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,18 @@ public function provideNodes()
245245
],
246246
];
247247
}
248+
249+
public function testWithUninitializedXMLReader()
250+
{
251+
$this->reader = new \XmlReader();
252+
253+
$expectedDump = <<<'EODUMP'
254+
XMLReader {
255+
+nodeType: NONE
256+
…13
257+
}
258+
EODUMP;
259+
260+
$this->assertDumpMatchesFormat($expectedDump, $this->reader);
261+
}
248262
}

0 commit comments

Comments
 (0)