xref: /PHP-7.4/sapi/cgi/tests/bug75574_utf8.phpt (revision 26dfce7f)
1--TEST--
2Bug #75574 putenv does not work properly if parameter contains non-ASCII unicode character, UTF-8
3--SKIPIF--
4<?php
5include "skipif.inc";
6?>
7--FILE--
8<?php
9/*
10#vim: set fileencoding=utf-8
11#vim: set encoding=utf-8
12*/
13
14include "include.inc";
15
16$php = get_cgi_path();
17reset_env_vars();
18
19$fn = __DIR__ . DIRECTORY_SEPARATOR . md5(uniqid());
20file_put_contents($fn, "<?php\nvar_dump(putenv('FOO=啊'));\n//var_dump(`echo %FOO%`);\nvar_dump(getenv('FOO'));");
21
22echo shell_exec("$php -n -f $fn");
23
24unlink($fn);
25
26?>
27===DONE===
28--EXPECT--
29bool(true)
30string(3) "啊"
31===DONE===
32