1--TEST--
2pcntl_exec(): Test cleanup after value that contain null bytes has been encountered for $args and $env_vars.
3--EXTENSIONS--
4pcntl
5--FILE--
6<?php
7try {
8    pcntl_exec('cmd', ['-n', "value\0null\0byte"]);
9} catch (Throwable $e) {
10    echo $e::class, ': ', $e->getMessage(), "\n";
11}
12
13try {
14    pcntl_exec(
15        'cmd',
16        ['-n'],
17        ['var1' => 'value1', 'var2' => "value\0null\0byte"],
18    );
19} catch (Throwable $e) {
20    echo $e::class, ': ', $e->getMessage(), "\n";
21}
22
23try {
24    pcntl_exec(
25        'cmd',
26        ['-n'],
27        ['var1' => 'value1', "key\0null\0byte" => "value2"],
28    );
29} catch (Throwable $e) {
30    echo $e::class, ': ', $e->getMessage(), "\n";
31}
32?>
33--EXPECT--
34ValueError: pcntl_exec(): Argument #2 ($args) individual argument must not contain null bytes
35ValueError: pcntl_exec(): Argument #3 ($env_vars) value for environment variable must not contain null bytes
36ValueError: pcntl_exec(): Argument #3 ($env_vars) name for environment variable must not contain null bytes
37