From 8e3f638109ebdb4bedc3e9ed7360b9d2467bc311 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 16 Sep 2006 19:47:15 +0000 Subject: Fixed #378 --- framework/Web/THttpRequest.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index dc3143e6..33839ed0 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -130,6 +130,16 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar */ public function init($config) { + // Fill in default request info when the script is run in command line + if(php_sapi_name()==='cli') + { + $_SERVER['REMOTE_ADDR']='127.0.0.1'; + $_SERVER['REQUEST_METHOD']='GET'; + $_SERVER['SERVER_NAME']='localhost'; + $_SERVER['SERVER_PORT']=80; + $_SERVER['HTTP_USER_AGENT']=''; + } + // Info about server variables: // PHP_SELF contains real URI (w/ path info, w/o query string) // SCRIPT_NAME is the real URI for the requested script (w/o path info and query string) -- cgit v1.2.3