Opened 5 years ago
Closed 5 years ago
#1484734 closed Feature Patches (wontfix)
function getallheaders exists when using litespeed, but shouldn't, and returns an empty array.
| Reported by: | phallstrom | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-stable |
| Component: | Core functionality | Version: | git-master |
| Severity: | normal | Keywords: | |
| Cc: |
Description
On a trunk checkout of a day or two ago (971) roundcube doesn't work with the litespeed webserver. The function 'getallheaders' is only supposed to be defined for apache, but it's also defined for the litespeed-php module, but returns an empty array. This breaks the ajax checks (see bug 1484508 for related info).
This patch fixes it:
Index: program/include/rcube_shared.inc
===================================================================
--- program/include/rcube_shared.inc (revision 971)
+++ program/include/rcube_shared.inc (working copy)
@@ -535,7 +535,7 @@
*/
function rc_request_header($name)
{
- if (function_exists('getallheaders'))
+ if (function_exists('getallheaders') && php_sapi_name() != 'litespeed')
{
$hdrs = array_change_key_case(getallheaders(), CASE_UPPER);
$key = strtoupper($name);
I've also let litespeed know about this and suggested they either implement the method or remove it...
http://www.litespeedtech.com/support/forum/showthread.php?p=8487
Change History (3)
comment:1 Changed 5 years ago by phallstrom
comment:2 Changed 5 years ago by thomasb
- Milestone set to 0.1-stable
- Severity changed from critical to normal
You better report this bug to litespeed.
comment:3 Changed 5 years ago by till
- Resolution set to wontfix
- Status changed from new to closed
Sorry, just had to laugh at this one, especially since they now implemented it:
It has been fixed in our latest php-litespeed SAPI 4.5 release. Added implementation of getallheaders() and apache_request_headers()
Therefor I am closing this ticket. It also makes no sense to correct this for any other webserver since the code checks if the function exists. If it exists, it should be available.
Not a RoundCube bug'''

It occurs to me that a better check would be to check *for* php_sapi_name matching 'apache'... as this must be a problem for other modules as well...
Index: program/include/rcube_shared.inc =================================================================== --- program/include/rcube_shared.inc (revision 971) +++ program/include/rcube_shared.inc (working copy) @@ -535,7 +535,7 @@ */ function rc_request_header($name) { - if (function_exists('getallheaders')) + if (function_exists('getallheaders') && ereg('^apache', php_sapi_name())) { $hdrs = array_change_key_case(getallheaders(), CASE_UPPER); $key = strtoupper($name); Index: .htaccess ===================================================================