summaryrefslogtreecommitdiff
path: root/ext/standard/tests/general_functions/ini_set_types.phpt
blob: 16def381db8c90fb5cb2cf646041b1ee27cff7d1 (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
--TEST--
ini_set() accepts non-strings under strict_types
--FILE--
<?php
declare(strict_types=1);

ini_set('docref_root', null);
var_dump(ini_get('docref_root'));
ini_set('html_errors', true);
var_dump(ini_get('html_errors'));
ini_set('html_errors', false);
var_dump(ini_get('html_errors'));
ini_set('precision', 6);
var_dump(ini_get('precision'));

// There are no float options in always enabled extensions.
// Just use a random string property, even though it doesn't make sense.
ini_set('user_agent', 3.14);
var_dump(ini_get('user_agent'));

try {
    ini_set('foo', []);
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}

?>
--EXPECT--
string(0) ""
string(1) "1"
string(0) ""
string(1) "6"
string(4) "3.14"
ini_set(): Argument #2 ($value) must be of type string|int|float|bool|null