Potx shouldn't parse yaml files, unless they have a known name pattern.

CommentFileSizeAuthor
#2 2628354.patch4.34 KBherom

Comments

herom created an issue. See original summary.

herom’s picture

Status: Active » Needs review
StatusFileSize
new4.34 KB

Modified the code to parse the Yaml files as late as possible. But, that meant some files might get parsed multiple times, so I'm also storing the last parsed parsed yaml.

Let's see if this works.

gábor hojtsy’s picture

How does this patch solve the issue title / summary?

herom’s picture

+++ b/potx.inc
@@ -2072,29 +2072,23 @@ function _potx_parse_yaml_file($code, $file_name, $file_path, $save_callback) {
-  try {
-    $yaml = Yaml::parse($code);
-
...
+      $yaml = _potx_get_parsed_yaml($file_name, $code);
...
+    $yaml = _potx_get_parsed_yaml($file_name, $code);

@@ -2103,6 +2097,11 @@ function _potx_parse_yaml_file($code, $file_name, $file_path, $save_callback) {
+    $yaml = _potx_get_parsed_yaml($file_name, $code);

This part does that. _potx_parse_yaml_file() is called for any yaml files we see. But it used to parse the yaml files early on, before checking its name pattern. Now, we only parse it (inside the ifs) when we are sure that it has one of the known file name patterns.

heddn’s picture

Status: Needs review » Closed (outdated)

7.x branch of this code is not actively supported. If this is still an issue in a more modern version of drupal, feel free to re-open.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.