Skip to content

Commit f466de7

Browse files
committed
Release 1.0.2
1 parent c0699e9 commit f466de7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"description": "Sidworks Developer tools for Shopware 6",
44
"type": "shopware-platform-plugin",
55
"license": "MIT",
6-
"version": "1.0.1",
6+
"version": "1.0.2",
77
"authors": [
88
{
99
"name": "Sidworks"
1010
}
1111
],
1212
"require": {
13-
"shopware/core": "^6.6"
13+
"shopware/core": "~6.6.0 || ~6.7.0"
1414
},
1515
"autoload": {
1616
"psr-4": {
@@ -20,10 +20,12 @@
2020
"extra": {
2121
"shopware-plugin-class": "Sidworks\\DevTools\\SidworksDevTools",
2222
"label": {
23-
"en-GB": "Sidworks Developer Tools"
23+
"en-GB": "Sidworks Developer Tools",
24+
"de-DE": "Sidworks Entwicklerwerkzeuge"
2425
},
2526
"description": {
26-
"en-GB": "Developer tools to inspect HTML elements and identify their source Twig templates"
27+
"en-GB": "Developer tools to inspect HTML elements and identify their source Twig templates",
28+
"de-DE": "Entwicklerwerkzeuge zum Untersuchen von HTML Elementen und zum Identifizieren der zugehörigen Twig Vorlagen"
2729
}
2830
}
2931
}

src/Subscriber/ResponseSubscriber.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ private function removeCommentsFromAttributes(string $content): string
9090
{
9191
// Simple approach: find all attribute values (text between ="" quotes)
9292
// and remove SWDT comments from them
93-
return preg_replace_callback(
93+
$result = preg_replace_callback(
9494
'/(\w+)="((?:[^"\\\\]|\\\\.)*)"/s',
9595
function ($matches) {
9696
$attrName = $matches[1];
@@ -107,6 +107,9 @@ function ($matches) {
107107
},
108108
$content
109109
);
110+
111+
// Return original content if preg_replace_callback failed (returns null on error)
112+
return $result ?? $content;
110113
}
111114

112115
/**
@@ -122,7 +125,7 @@ private function removeCommentsFromSpecialTags(string $content): string
122125
foreach ($specialTags as $tag) {
123126
// Match opening tag, content, and closing tag
124127
// Use backreference \1 to match the same tag name in closing tag
125-
$content = preg_replace_callback(
128+
$result = preg_replace_callback(
126129
'/<(' . $tag . ')([^>]*)>(.*?)<\/\1>/si',
127130
function ($matches) {
128131
$tag = $matches[1];
@@ -144,6 +147,9 @@ function ($matches) {
144147
},
145148
$content
146149
);
150+
151+
// Keep original content if preg_replace_callback failed (returns null on error)
152+
$content = $result ?? $content;
147153
}
148154

149155
return $content;

0 commit comments

Comments
 (0)