User tests: Successful: Unsuccessful:
In some envoirments ini_get('xcache.admin.enable_auth') is off but return empty.
Title |
|
||||||
Labels |
Added:
?
?
|
What exactly is returned by ini_get in that case? An empty string or null?
Can you answer here @anibalsanchez ?
I only create the patch based on the comment by @anibalsanchez on the JC Tracker.
Same issue here!
In PHP Information tab: xcache.admin.enable_auth=Off
ini_get('xcache.admin.enable_auth') is empty
Confirmed in PHP 5.5.3 and 5.3.10.Quick fix, xcache.php, line 238, return true; ... or check for empty $xcache_admin_enable_auth a couple of lines below.
if (extension_loaded('xcache'))
{
// XCache Admin must be disabled for Joomla to use XCache
$xcache_admin_enable_auth = ini_get('xcache.admin.enable_auth');
isset($xcache_admin_enable_auth) => true
empty($xcache_admin_enable_auth) => true
is_null($xcache_admin_enable_auth) => false
($xcache_admin_enable_auth === '0') => false
($xcache_admin_enable_auth == '0') => false
($xcache_admin_enable_auth === '') => true
($xcache_admin_enable_auth == '') => true
($xcache_admin_enable_auth === '') => true
Looks like it's an empty string then. I'd suggest to use this as the check instead of empty
which may be to generic.
done @Bakual with zero-24@6a2e70a
Looks good to me. @anibalsanchez can you please test this latest version again?
It works perfect! I've already deployed to it several sites.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-08-09 18:16:02 |
thanks @anibalsanchez and @Bakual
What exactly is returned by ini_get in that case? An empty string or
null
?Because looking at the existing checks and its comments it seems to be important to not use a generic boolean like
empty
here. If you check here using empty, the previous check which explicitely checks for an integer0
would be not needed anymore.empty
will return true for a booleanfalse
, an integer0
, an empty string or a string containing0
and fornull
.