php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #60850
Patch add_router_script_file_name_svr_var revision 2012-03-09 02:19 UTC by sam dot e dot giles at googlemail dot com

Patch add_router_script_file_name_svr_var for Built-in web server Bug #60850

Patch version 2012-03-09 02:19 UTC

Return to Bug #60850 | Download this patch
Patch Revisions:

Developer: sam.e.giles@googlemail.com

Index: sapi/cli/php_cli_server.c
===================================================================
--- sapi/cli/php_cli_server.c	(revision 324038)
+++ sapi/cli/php_cli_server.c	(working copy)
@@ -598,7 +598,12 @@
 	sapi_cli_server_register_variable(track_vars_array, "SCRIPT_NAME", client->request.vpath TSRMLS_CC);
 	if (SG(request_info).path_translated) {
 		sapi_cli_server_register_variable(track_vars_array, "SCRIPT_FILENAME", SG(request_info).path_translated TSRMLS_CC);
-	}
+	} else if (client->server->router) {
+		char* temp;
+		spprintf(&temp, 0, "%s/%s", client->server->document_root, client->server->router);
+		sapi_cli_server_register_variable(track_vars_array, "SCRIPT_FILENAME", temp TSRMLS_CC);
+        }
+
 	if (client->request.path_info) {
 		sapi_cli_server_register_variable(track_vars_array, "PATH_INFO", client->request.path_info TSRMLS_CC);
 	}
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 19:02:15 2014 UTC