Skip to content

Commit d69bbe5

Browse files
authored
Merge pull request #43 from utopia-php/fix-15x-equals-parsing
Fix: Equals symbol in value
2 parents ccb7c81 + 0ff8b37 commit d69bbe5

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/CLI/CLI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public function parse(array $args): array
244244
unset($arg);
245245

246246
foreach ($args as $arg) {
247-
$pair = explode('=', $arg);
247+
$pair = explode('=', $arg, 2);
248248
$key = $pair[0];
249249
$value = $pair[1];
250250
$output[$key][] = $value;

tests/CLI/CLITest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,26 @@ public function testMatch()
247247

248248
$this->assertEquals(null, $cli->match());
249249
}
250+
251+
public function testEscaping()
252+
{
253+
ob_start();
254+
255+
$database = 'appwrite://database_db_fra1_self_hosted_0_0?database=appwrite&namespace=_1';
256+
257+
$cli = new CLI(new Generic(), ['test.php', 'connect', '--database='.$database]);
258+
259+
$cli
260+
->task('connect')
261+
->param('database', null, new Text(2048), 'Database DSN')
262+
->action(function ($database) {
263+
echo $database;
264+
});
265+
266+
$cli->run();
267+
268+
$result = ob_get_clean();
269+
270+
$this->assertEquals($database, $result);
271+
}
250272
}

0 commit comments

Comments
 (0)