Opened 8 years ago

Closed 8 years ago

#1116 closed defect (fixed)

sub_filter and addition - bug

Reported by: gglater62@… Owned by:
Priority: major Milestone:
Component: other Version: 1.11.x
Keywords: sub_filter addition Cc:
uname -a: Linux lenovo 4.8.2-1 #1 SMP Sun Oct 16 20:17:01 CEST 2016 x86_64 Intel(R)_Core(TM)_i5_CPU_______M_520__@_2.40GHz PLD Linux
nginx -V: nginx version: nginx/1.11.3
built by gcc 5.4.0 20160603 (release) (PLD-Linux)
built with OpenSSL 1.0.2j 26 Sep 2016
TLS SNI support enabled
configure arguments: --prefix=/usr --sbin-path=/usr/sbin/nginx-standard --conf-path=/etc/nginx/nginx-standard.conf --error-log-path=/var/log/nginx/nginx-standard_error.log --http-log-path=/var/log/nginx/nginx-standard_access.log --pid-path=/var/run/nginx-standard.pid --lock-path=/var/lock/subsys/nginx-standard --http-client-body-temp-path=/var/cache/nginx-standard/client_body_temp --http-fastcgi-temp-path=/var/cache/nginx-standard/fastcgi_temp --http-proxy-temp-path=/var/cache/nginx-standard/proxy_temp --user=nginx --group=nginx --with-ipv6 --with-select_module --with-poll_module --with-cc=x86_64-pld-linux-gcc --with-cc-opt='-O2 -fwrapv -pipe -Wformat -Werror=format-security -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC -march=x86-64 -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2' --with-ld-opt='-Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc' --with-debug --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_sub_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --without-http_browser_module --with-http_auth_request_module --with-threads --with-http_v2_module --with-http_secure_link_module --with-debug

Description

Addition with sub_filter and php-fpm is bogus.

Here is fragment of nginx.conf:

add_after_body /after.html;
sub_filter_once on;
sub_filter </body 'SOMETHING
</body';

location = /aaa.php {
root /home/services/nginx/html;
include /etc/nginx/fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/services/nginx/html/aaa.php;
fastcgi_pass unix:/var/run/php/php70-fpm.sock;
}

location / {
autoindex on;
root /home/services/nginx/html;
index index.html index.htm index.php;
}

aaa.php:
<?php
echo 'It does not work.';

after.html:
<!-- bla</body>-->

Output of http://localhost/aaa.php is following:
It does not <!-- blaSOMETHING
</body>-->
work.

Expected:
It does not work.<!-- blaSOMETHING
</body>-->

Issue occurs also in 1.10.2

Change History (1)

comment:1 by Roman Arutyunyan, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.