Skip to content

Commit 0e414fe

Browse files
Allow the escaping of & using &. Example: zs-client.php configurationStoreDirectives --directives="error_reporting=E_ALL & ~E_NOTICE & ~E_USER_NOTICE"
1 parent 2da7666 commit 0e414fe

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

module/Client/src/Client/Utils.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ abstract class Utils
1616
public static function parseString($string, &$data, $delimiter = '&')
1717
{
1818
// check if the values are provided like a query string
19+
$string = str_replace('&', chr(0x7f) . chr(0xff) . chr(0x7f), $string); // escaped ampersand
1920
$pairs = explode($delimiter, $string);
2021
foreach ($pairs as $pair) {
2122
list($k, $v) = explode('=', $pair);
22-
23+
$v = str_replace(chr(0x7f) . chr(0xff) . chr(0x7f), '&', $v); // replace escaped ampersand
2324
if (preg_match("/^(.*?)((\[(.*?)\])+)$/m", $k, $m)) {
2425
$parts = explode('][', rtrim(ltrim($m[2], '['), ']'));
2526
$json = '{"'.implode('":{"', $parts).'": '.json_encode($v).str_pad('', count($parts), '}');

0 commit comments

Comments
 (0)