Skip to content
docsv0.13.0

ShellArgument

One argument for a POSIX shell, quoted byte for byte (greenhouse decisions/0624). `escapeshellarg()` reads LC_CTYPE: under the C locale (measured on PHP 8.2 to 8.5) it drops the bytes it cannot place, so `escapeshellarg('sí')` is `'s'`. PHP itself starts at C.UTF-8; a process reaches C when something calls setlocale() from a C/POSIX environment, or where libc has no C.UTF-8. The line a person was offered to sign then named another answer, and a path with an accent named another path. This quotes the same way (single quotes, each `'` closed, escaped and reopened) without asking the locale anything. It lives here, in the lowest package every runner and every surface that offers a line to sign depends on, so that there is one way to quote and not one per package (greenhouse decisions/0624, point 4).

ShellArgument::quote()

public static function quote(string $value): string

The argument between single quotes, every byte kept.

Parameters

Parameters of quote()
NameTypeDescription
$valuestring

Throws

\ValueError when the value holds a NUL byte, which no shell argument can carry (as escapeshellarg)