summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2023-01-25 21:46:01 +0000
committerAndrew Clayton <a.clayton@nginx.com>2023-01-27 14:46:45 +0000
commitfafdb7a57ad976e048147fe23079dca9c602e88a (patch)
tree35bd0e0f5a228ecda2999d6aaed5918e6d610763
parent3923de987efa79645b3e30a55adca4375e0843e2 (diff)
downloadunit-fafdb7a57ad976e048147fe23079dca9c602e88a.tar.gz
unit-fafdb7a57ad976e048147fe23079dca9c602e88a.tar.bz2
PHP: Simplify ctx->script_filename.start in nxt_php_execute().
Create a const char *filename variable to hold ctx->script_filename.start, which is a much more manageable name and will negate the need for any more casting in the following commit when we switch to using a FILE * instead of a filename in php_execute_script(). Reviewed-by: Alejandro Colomar <alx@nginx.com> Cc: Andrei Zeliankou <zelenkov@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
-rw-r--r--src/nxt_php_sapi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c
index 0445533e..b517f7c3 100644
--- a/src/nxt_php_sapi.c
+++ b/src/nxt_php_sapi.c
@@ -1132,11 +1132,13 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
#if (PHP_VERSION_ID < 50600)
void *read_post;
#endif
+ const char *filename;
nxt_unit_field_t *f;
zend_file_handle file_handle;
- nxt_unit_req_debug(ctx->req, "PHP execute script %s",
- ctx->script_filename.start);
+ filename = (const char *) ctx->script_filename.start;
+
+ nxt_unit_req_debug(ctx->req, "PHP execute script %s", filename);
SG(server_context) = ctx;
SG(options) |= SAPI_OPTION_NO_CHDIR;
@@ -1196,8 +1198,7 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
nxt_php_vcwd_chdir(ctx->req, ctx->script_dirname.start);
}
- nxt_zend_stream_init_filename(&file_handle,
- (const char *) ctx->script_filename.start);
+ nxt_zend_stream_init_filename(&file_handle, filename);
php_execute_script(&file_handle TSRMLS_CC);