Opened 4 years ago

Closed 4 years ago

#745 closed defect (invalid)

if(false) does not work in 1.6.3

Reported by: www.google.com/accounts/o8/id?id=AItOawlDbFjsF5tZEnSJA0U-KXafySNVFI5Z8LE Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.6.x
Keywords: Cc:
uname -a: Linux techs 2.6.32-042stab093.5 #1 SMP Wed Sep 10 17:39:49 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.6.3 built by gcc 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'

Description

After updating to 1.6.3, if(false) does not work.

set $test false;
set $test2 false;
if ($test) {
    set $test2 true;
}
add_header X-test "$test2";

This setting will set X-test header "true".
In 1.6.2, it worked perfectly and X-test header was "false".

Change History (1)

comment:1 Changed 4 years ago by mdounin

  • Resolution set to invalid
  • Status changed from new to closed

There are no special "true" and "false" values in nginx. Both "true" and "false" are just strings in the configuration provided, and both are true values from nginx point of view, quoting the "if" directive description:

a variable name; false if the value of a variable is an empty string or “0”;

It works this way since nginx 0.3.8. That is, both 1.6.3 and 1.6.2 do the same.

Note: See TracTickets for help on using tickets.