Skip to content

Commit

Permalink
Merge pull request #435 from jackalope/system-view-robustness
Browse files Browse the repository at this point in the history
fix reference deletion to not be case sensitive
  • Loading branch information
dbu committed Jan 8, 2024
2 parents c614b96 + 442681b commit 7549f8d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
1.x
===

1.11.1
------

* Fix regression of 1.11.0: Reference deletion should work regardless of upper or lowercase of the type names in XML data.

1.11.0
------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Jackalope\Transport\DoctrineDBAL\XmlPropsRemover;

use PHPCR\PropertyType;

/**
* @internal
*/
Expand Down Expand Up @@ -99,14 +101,16 @@ private function startHandler($parser, $name, $attrs): void
if ($name === 'SV:PROPERTY') {
$svName = $attrs['SV:NAME'];

if (\in_array($svName, $this->propertyNames)) {
if (\in_array((string) $svName, $this->propertyNames, true)) {
$this->skipCurrentTag = true;
$svType = $attrs['SV:TYPE'];

if ($svType === 'reference') {
$this->references[] = $svName;
} elseif ($svType === 'weakreference') {
$this->weakReferences[] = $svName;
// use PHPCR PropertyType to avoid encoding issues
switch (PropertyType::valueFromName($attrs['SV:TYPE'])) {
case PropertyType::REFERENCE:
$this->references[] = $svName;
break;
case PropertyType::WEAKREFERENCE:
$this->weakReferences[] = $svName;
break;
}

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testParseWithoutSvValueNode(): void
<sv:value length="15">nt:unstructured</sv:value>
</sv:property>
<sv:property sv:name="block_1_ref" sv:type="reference" sv:multi-valued="0">1922ec03-b5ed-40cf-856c-ecfb8eac12e2</sv:property>
<sv:property sv:name="block_2_ref" sv:type="reference" sv:multi-valued="0">94c9aefe-faaa-4896-816b-5bfc575681f0</sv:property>
<sv:property sv:name="block_2_ref" sv:type="Reference" sv:multi-valued="0">94c9aefe-faaa-4896-816b-5bfc575681f0</sv:property>
<sv:property sv:name="block_3_ref" sv:type="weakreference" sv:multi-valued="0">a8ae4420-095b-4045-8775-b731cbae2fe1</sv:property>
<sv:property sv:name="external_reference" sv:type="reference" sv:multi-valued="0">
<sv:value length="36">842e61c0-09ab-42a9-87c0-308ccc90e6f6</sv:value>
Expand Down

0 comments on commit 7549f8d

Please sign in to comment.