summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/putenv.phpt
blob: c1f4f98eeb565b5191e72bfb2f0d71efb5ddd2bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
putenv() basic tests
--FILE--
<?php

$var_name="SUCHVARSHOULDNOTEXIST";

var_dump(getenv($var_name));
var_dump(putenv($var_name."=value"));
var_dump(getenv($var_name));

var_dump(putenv($var_name."="));
var_dump(getenv($var_name));

var_dump(putenv($var_name));
var_dump(getenv($var_name));

try {
    putenv("=123");
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

try {
    putenv("");
} catch (ValueError $exception) {
    echo $exception->getMessage() . "\n";
}

echo "Done\n";
?>
--EXPECTF--
bool(false)
bool(true)
string(5) "value"
bool(true)
string(0) ""
bool(true)
bool(false)
Invalid parameter syntax
Invalid parameter syntax
Done