Skip to content

Commit 83d8b85

Browse files
committed
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 <[email protected]> Cc: Andrei Zeliankou <[email protected]> Signed-off-by: Andrew Clayton <[email protected]>
1 parent d571838 commit 83d8b85

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/nxt_php_sapi.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,11 +1132,13 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
11321132
#if (PHP_VERSION_ID < 50600)
11331133
void *read_post;
11341134
#endif
1135+
const char *filename;
11351136
nxt_unit_field_t *f;
11361137
zend_file_handle file_handle;
11371138

1138-
nxt_unit_req_debug(ctx->req, "PHP execute script %s",
1139-
ctx->script_filename.start);
1139+
filename = (const char *) ctx->script_filename.start;
1140+
1141+
nxt_unit_req_debug(ctx->req, "PHP execute script %s", filename);
11401142

11411143
SG(server_context) = ctx;
11421144
SG(options) |= SAPI_OPTION_NO_CHDIR;
@@ -1196,8 +1198,7 @@ nxt_php_execute(nxt_php_run_ctx_t *ctx, nxt_unit_request_t *r)
11961198
nxt_php_vcwd_chdir(ctx->req, ctx->script_dirname.start);
11971199
}
11981200

1199-
nxt_zend_stream_init_filename(&file_handle,
1200-
(const char *) ctx->script_filename.start);
1201+
nxt_zend_stream_init_filename(&file_handle, filename);
12011202

12021203
php_execute_script(&file_handle TSRMLS_CC);
12031204

0 commit comments

Comments
 (0)