Patch fix37672 for Scripting Engine problem Bug #37672
Patch version 2013-08-21 04:31 UTC
Return to Bug #37672 |
Download this patch
Patch Revisions:
Developer: ku@digitaldolphins.jp
From 20473a3de896235bae1d42965f071fb0ee62835e Mon Sep 17 00:00:00 2001
From: ku <ku@digitaldolphins.jp>
Date: Wed, 21 Aug 2013 13:31:04 +0900
Subject: [PATCH] My fix for bug #37672 Cannot start script from directory
containing international characters.
---
sapi/apache2handler/sapi_apache2.c | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index b7f95e0..80b42f7 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -541,10 +541,33 @@ static int php_handler(request_rec *r)
apr_bucket *bucket;
apr_status_t rv;
request_rec * volatile parent_req = NULL;
+ char *fp_script = NULL;
TSRMLS_FETCH();
#define PHPAP_INI_OFF php_apache_ini_dtor(r, parent_req TSRMLS_CC);
+#ifdef PHP_WIN32
+ {
+ int cch, cb;
+ WCHAR *wc_fp_script = apr_pcalloc(r->pool, sizeof(WCHAR) * MAX_PATH);
+ fp_script = apr_pcalloc(r->pool, MAX_PATH);
+
+ cch = MultiByteToWideChar(CP_UTF8, 0, r->filename, -1, wc_fp_script, MAX_PATH);
+ if (wc_fp_script == NULL || cch == 0) {
+ PHPAP_INI_OFF;
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ cb = WideCharToMultiByte(CP_ACP, 0, wc_fp_script, -1, fp_script, MAX_PATH, 0, 0);
+ if (fp_script == NULL || cb == 0) {
+ PHPAP_INI_OFF;
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+ }
+#else
+ fp_script = (char *)r->filename;
+#endif
+
conf = ap_get_module_config(r->per_dir_config, &php5_module);
/* apply_config() needs r in some cases, so allocate server_context early */
@@ -654,12 +677,12 @@ zend_first_try {
if (strncmp(r->handler, PHP_SOURCE_MAGIC_TYPE, sizeof(PHP_SOURCE_MAGIC_TYPE) - 1) == 0) {
zend_syntax_highlighter_ini syntax_highlighter_ini;
php_get_highlight_struct(&syntax_highlighter_ini);
- highlight_file((char *)r->filename, &syntax_highlighter_ini TSRMLS_CC);
+ highlight_file(fp_script, &syntax_highlighter_ini TSRMLS_CC);
} else {
zend_file_handle zfd;
zfd.type = ZEND_HANDLE_FILENAME;
- zfd.filename = (char *) r->filename;
+ zfd.filename = fp_script;
zfd.free_filename = 0;
zfd.opened_path = NULL;
--
1.7.11.msysgit.1
|