Skip to content

Commit 143c645

Browse files
committed
Fix bug in Command::text()
1 parent 11dfa2f commit 143c645

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Command.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,8 @@ public function rawCommand(string $command, bool $append = false): self
597597
*/
598598
public function text(array $options = []): self
599599
{
600-
$mandatoryKeys = ['text', 'geometry', 'textSize'];
601-
foreach ($options as $key => $v) {
602-
if (!isset($mandatoryKeys[$key])) {
600+
foreach (['text', 'geometry', 'textSize'] as $key) {
601+
if (!isset($options[$key])) {
603602
throw new \InvalidArgumentException(\sprintf('Key "%s" is missing for the %s function.', $key, __METHOD__));
604603
}
605604
}
@@ -624,7 +623,8 @@ public function text(array $options = []): self
624623
$this->stroke('none');
625624

626625
$this->command[] = '-annotate';
627-
$this->command[] = '"'.$this->ref->geometry($geometry).'"'.$text;
626+
$this->command[] = '"'.$this->ref->geometry($geometry).'"';
627+
$this->command[] = \escapeshellarg($text);
628628

629629
return $this;
630630
}

0 commit comments

Comments
 (0)