I carefully read the code of "ngx_set_env" and "ngx_set_environment". And I found that once "ngx_set_environment" is invoked, the arguments of "env" directive is put into "envrion", which makes those variables effective.
However, this works well only when ngx_set_environment is invoked. And ngx_set_environment will be invoked only when new worker process is initiated. But in the developement/debug mode (daemon off, master_process off), the variables will never be put into environ, which may incur some inconsistent bug when nginx is running in dev mode and production mode.
Therefore, I think this is a bug.