goutamadwant opened a new pull request, #13727:
URL: https://github.com/apache/apisix/pull/13727

   ### Description
   
   Logger plugins run an access-phase handler to capture request bodies. This 
caused `_meta.filter` expressions that reference response variables to be 
evaluated before those variables were available, with the access-phase result 
reused during the log phase. Reading `$status` during access also cached `0` in 
`ctx.var`, which could affect other plugins on the same request.
   
   This change:
   
   - scopes `_meta.filter` result caching to each execution phase, while 
retaining caching for repeated callbacks within the same phase
   - prevents `$status` from being cached because its value changes after the 
response status is determined
   - adds regression coverage for response-phase filters and cross-plugin 
status isolation
   
   #### Which issue(s) this PR fixes:
   
   Fixes #13724
   
   ### Tests
   
   - `prove -I. -r t/core/ctx2.t`
   - `prove -I. -r t/plugin/file-logger3.t`
   - `prove -I. -r t/plugin/plugin.t`
   - `prove -I. -r t/plugin/file-logger.t t/plugin/file-logger2.t`
   - `./utils/lj-releng apisix/plugin.lua apisix/core/ctx.lua`
   
   The issue scenarios were also reproduced on APISIX 3.17.0 and verified 
against the patched source. Gateway-generated 404 responses are filtered as 
configured, while upstream 200 and 404 responses are logged with their actual 
status values.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change (Not 
applicable: this restores existing behavior without changing configuration or 
public APIs.)
   - [x] I have verified that this change is backward compatible (If not, 
please discuss on the [APISIX mailing 
list](https://github.com/apache/apisix/tree/master#community) first)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to