summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--HISTORY1
-rw-r--r--UPGRADE3
-rw-r--r--framework/Web/THttpRequest.php38
3 files changed, 23 insertions, 19 deletions
diff --git a/HISTORY b/HISTORY
index 319b9915..bc7158d2 100644
--- a/HISTORY
+++ b/HISTORY
@@ -64,6 +64,7 @@ BUG: Issue #377 - THtmlArea Template Pluggin Options Parse Error (ctrlaltca)
BUG: Issue #379 - JSON float encoding depends on current locale (ctrlaltca)
BUG: Issue #380 - TCustomValidator's ControlToValidate should be optional (ctrlaltca)
BUG: Issue #381 - The property CausesValidation in the TActiveDatePicker not work (ctrlaltca)
+BUG: Issue #383 - Some THttpRequest methods raise NOTICE level errors on missing headers (gabor)
Version 3.1.10 Jul 17, 2011
BUG: Added missing timeout on TCacheHttpSession (ctrlaltca)
diff --git a/UPGRADE b/UPGRADE
index 5e21c892..e19e6239 100644
--- a/UPGRADE
+++ b/UPGRADE
@@ -39,6 +39,9 @@ Upgrading from v3.1.x
uppercase P). Using capital letters for the initial letter of the directories name is a long-time
convention in prado, and this has been changed to reflect it. TPageService has been patched anyway to
support even the old "Application.pages" to avoid breaking existing code.
+- All the THttpRequest's methods used to gather server informations have been paired to return null if no
+ information is available. Previously some of them returned an empty string (getQueryString and
+ getHttpProtocolVersion), some other returned null, others caused a php NOTICE.
Upgrading from v3.1.10
----------------------
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index 142b5813..616f97e4 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -320,7 +320,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getRequestType()
{
- return $_SERVER['REQUEST_METHOD'];
+ return isset($_SERVER['REQUEST_METHOD'])?$_SERVER['REQUEST_METHOD']:null;
}
/**
@@ -359,15 +359,15 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getQueryString()
{
- return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:'';
+ return isset($_SERVER['QUERY_STRING'])?$_SERVER['QUERY_STRING']:null;
}
/**
* @return string the requested http procolol. Blank string if not defined.
*/
- public function getHttpProtocolVersion ()
+ public function getHttpProtocolVersion()
{
- return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:'';
+ return isset($_SERVER['SERVER_PROTOCOL'])?$_SERVER['SERVER_PROTOCOL']:null;
}
/**
@@ -428,7 +428,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME']))
return $_SERVER['ORIG_SCRIPT_NAME'];
- return $_SERVER['SCRIPT_NAME'];
+ return isset($_SERVER['SCRIPT_NAME'])?$_SERVER['SCRIPT_NAME']:null;
}
/**
@@ -448,7 +448,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getApplicationFilePath()
{
- return realpath($_SERVER['SCRIPT_FILENAME']);
+ return realpath(isset($_SERVER['SCRIPT_FILENAME'])?$_SERVER['SCRIPT_FILENAME']:null);
}
/**
@@ -456,7 +456,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getServerName()
{
- return $_SERVER['SERVER_NAME'];
+ return isset($_SERVER['SERVER_NAME'])?$_SERVER['SERVER_NAME']:null;
}
/**
@@ -464,7 +464,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getServerPort()
{
- return $_SERVER['SERVER_PORT'];
+ return isset($_SERVER['SERVER_PORT'])?$_SERVER['SERVER_PORT']:null;
}
/**
@@ -481,14 +481,14 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getBrowser()
{
- try
- {
- return get_browser();
- }
- catch(TPhpErrorException $e)
- {
- throw new TConfigurationException('httprequest_browscap_required');
- }
+ try
+ {
+ return get_browser();
+ }
+ catch(TPhpErrorException $e)
+ {
+ throw new TConfigurationException('httprequest_browscap_required');
+ }
}
/**
@@ -496,7 +496,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getUserAgent()
{
- return $_SERVER['HTTP_USER_AGENT'];
+ return isset($_SERVER['HTTP_USER_AGENT'])?$_SERVER['HTTP_USER_AGENT']:null;
}
/**
@@ -504,7 +504,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
*/
public function getUserHostAddress()
{
- return $_SERVER['REMOTE_ADDR'];
+ return isset($_SERVER['REMOTE_ADDR'])?$_SERVER['REMOTE_ADDR']:null;
}
/**
@@ -521,7 +521,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar
public function getAcceptTypes()
{
// TBD: break it into array??
- return $_SERVER['HTTP_ACCEPT'];
+ return isset($_SERVER['HTTP_ACCEPT'])?$_SERVER['HTTP_ACCEPT']:null;
}
/**