From c5d3127303995f1f8da0593dedd4785fbd3e985f Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Thu, 28 Feb 2019 10:41:52 +0100 Subject: [PATCH] Storage: Properly escape and unescape names with operators fixes #205 --- library/Businessprocess/Storage/LegacyConfigParser.php | 5 +++-- library/Businessprocess/Storage/LegacyConfigRenderer.php | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/library/Businessprocess/Storage/LegacyConfigParser.php b/library/Businessprocess/Storage/LegacyConfigParser.php index 10cfe7b..4293b1e 100644 --- a/library/Businessprocess/Storage/LegacyConfigParser.php +++ b/library/Businessprocess/Storage/LegacyConfigParser.php @@ -301,7 +301,7 @@ class LegacyConfigParser } $op = '&'; - if (preg_match_all('~([\|\+&\!])~', $value, $m)) { + if (preg_match_all('~(?setBpConfig($bp); - $cmps = preg_split('~\s*\\' . $op . '\s*~', $value, -1, PREG_SPLIT_NO_EMPTY); + $cmps = preg_split('~\s*(?hasNode($val)) { $node->addChild($bp->getNode($val)); diff --git a/library/Businessprocess/Storage/LegacyConfigRenderer.php b/library/Businessprocess/Storage/LegacyConfigRenderer.php index d90db95..77a1d13 100644 --- a/library/Businessprocess/Storage/LegacyConfigRenderer.php +++ b/library/Businessprocess/Storage/LegacyConfigRenderer.php @@ -184,7 +184,9 @@ class LegacyConfigRenderer { $op = static::renderOperator($node); $children = $node->getChildNames(); - $str = implode(' ' . $op . ' ', $children); + $str = implode(' ' . $op . ' ', array_map(function ($val) { + return preg_replace('~([\|\+&\!])~', '\\\\$1', $val); + }, $children)); if ((count($children) < 2) && $op !== '&') { return $op . ' ' . $str;