Permalink
Browse files

Prepare 3.4.7 Release

  • Loading branch information...
wilsonge committed Dec 21, 2015
1 parent 995db72 commit 2cd4ef682f0cab6ff03200b79007a25f19c6690e
@@ -575,9 +575,12 @@ public function save($data)
// Adding self to the association
$associations = $data['associations'];
// Unset any invalid associations
$associations = Joomla\Utilities\ArrayHelper::toInteger($associations);
foreach ($associations as $tag => $id)
{
if (empty($id))
if (!$id)
{
unset($associations[$tag]);
}
@@ -618,7 +621,7 @@ public function save($data)
foreach ($associations as $id)
{
$query->values($id . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
$query->values(((int) $id) . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
}
$db->setQuery($query);
@@ -1284,9 +1284,12 @@ public function save($data)
// Adding self to the association
$associations = $data['associations'];
// Unset any invalid associations
$associations = Joomla\Utilities\ArrayHelper::toInteger($associations);
foreach ($associations as $tag => $id)
{
if (empty($id))
if (!$id)
{
unset($associations[$tag]);
}
@@ -1330,7 +1333,7 @@ public function save($data)
foreach ($associations as $id)
{
$query->values($id . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
$query->values(((int) $id) . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
}
$db->setQuery($query);
@@ -6,7 +6,7 @@
<authorUrl>www.joomla.org</authorUrl>
<copyright>(C) 2005 - 2015 Open Source Matters. All rights reserved</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<version>3.4.6</version>
<version>3.4.7</version>
<creationDate>December 2015</creationDate>
<description>FILES_JOOMLA_XML_DESCRIPTION</description>
@@ -23,7 +23,7 @@
public $RELEASE = '3.4';
/** @var string Maintenance version. */
public $DEV_LEVEL = '6';
public $DEV_LEVEL = '7';
/** @var string Development STATUS. */
public $DEV_STATUS = 'Stable';
@@ -35,10 +35,10 @@
public $CODENAME = 'Ember';
/** @var string Release date. */
public $RELDATE = '15-December-2015';
public $RELDATE = '21-December-2015';
/** @var string Release time. */
public $RELTIME = '11:11';
public $RELTIME = '16:00';
/** @var string Release timezone. */
public $RELTZ = 'GMT';
@@ -199,7 +199,7 @@ public function connect()
public function disconnect()
{
// Close the connection.
if ($this->connection)
if ($this->connection->stat() !== false)
{
foreach ($this->disconnectHandlers as $h)
{
@@ -90,6 +90,12 @@ class JSession implements IteratorAggregate
* @since 12.2
*/
private $_dispatcher = null;
/**
* Internal data store for the session data
*
* @var \Joomla\Registry\Registry
*/
protected $data;
/**
* Constructor
*
@@ -263,7 +269,7 @@ public static function getFormToken($forceNew = false)
*/
public function getIterator()
{
return new ArrayIterator($_SESSION);
return new ArrayIterator($this->getData());
}
/**
* Checks for a form token in the request.
@@ -331,6 +337,17 @@ public function getId()
}
return session_id();
}
/**
* Returns a clone of the internal data pointer
*
* @return \Joomla\Registry\Registry
*/
public function getData()
{
return clone $this->data;
}
/**
* Get the session handlers
*
@@ -427,11 +444,8 @@ public function get($name, $default = null, $namespace = 'default')
$error = null;
return $error;
}
if (isset($_SESSION[$namespace][$name]))
{
return $_SESSION[$namespace][$name];
}
return $default;
return $this->data->get($namespace . '.' . $name, $default);
}
/**
* Set data into the session store.
@@ -453,16 +467,7 @@ public function set($name, $value = null, $namespace = 'default')
// @TODO :: generated error here
return null;
}
$old = isset($_SESSION[$namespace][$name]) ? $_SESSION[$namespace][$name] : null;
if (null === $value)
{
unset($_SESSION[$namespace][$name]);
}
else
{
$_SESSION[$namespace][$name] = $value;
}
return $old;
return $this->data->set($namespace . '.' . $name, $value);
}
/**
* Check whether data exists in the session store
@@ -483,7 +488,7 @@ public function has($name, $namespace = 'default')
// @TODO :: generated error here
return null;
}
return isset($_SESSION[$namespace][$name]);
return !is_null($this->data->get($namespace . '.' . $name, null));
}
/**
* Unset data from the session store
@@ -504,13 +509,7 @@ public function clear($name, $namespace = 'default')
// @TODO :: generated error here
return null;
}
$value = null;
if (isset($_SESSION[$namespace][$name]))
{
$value = $_SESSION[$namespace][$name];
unset($_SESSION[$namespace][$name]);
}
return $value;
return $this->data->set($namespace . '.' . $name, null);
}
/**
* Start a session.
@@ -575,16 +574,50 @@ protected function _start()
*
* Replace with session_register_shutdown() when dropping compatibility with PHP 5.3
*/
register_shutdown_function('session_write_close');
register_shutdown_function(array($this, 'close'));
session_cache_limiter('none');
session_start();
// Ok let's unserialize the whole thing
$this->data = new \Joomla\Registry\Registry;
// Try loading data from the session
if (isset($_SESSION['joomla']) && !empty($_SESSION['joomla']))
{
$data = $_SESSION['joomla'];
$data = base64_decode($data);
$this->data = unserialize($data);
}
// Migrate existing session data to avoid logout on update from J < 3.4.7
if (isset($_SESSION['__default']))
{
$migratableKeys = array("user", "session.token", "session.counter", "session.timer.start", "session.timer.last", "session.timer.now");
foreach ($migratableKeys as $migratableKey)
{
if (!empty($_SESSION['__default'][$migratableKey]))
{
// Don't overwrite existing session data
if(!is_null($this->data->get('__default.' . $migratableKey, null)))
{
continue;
}
$this->data->set('__default.' . $migratableKey, $_SESSION['__default'][$migratableKey]);
unset($_SESSION['__default'][$migratableKey]);
}
}
}
return true;
}
/**
* Frees all session variables and destroys all data registered to a session
*
* This method resets the $_SESSION variable and destroys all of the data associated
* with the current session in its storage (file or DB). It forces new session to be
* This method resets the data pointer and destroys all of the data associated
* with the current session in its storage (file or DB). It forces a new session to be
* started after this method is called. It does not unset the session cookie.
*
* @return boolean True on success
@@ -612,6 +645,7 @@ public function destroy()
$cookie_path = $config->get('cookie_path', '/');
setcookie(session_name(), '', time() - 42000, $cookie_path, $cookie_domain);
}
$this->data = new \Joomla\Registry\Registry;
session_unset();
session_destroy();
$this->_state = 'destroyed';
@@ -682,14 +716,28 @@ public function fork()
* frames by ending the session as soon as all changes to session variables are
* done.
*
* @return void
* @return boolean
*
* @see session_write_close()
* @since 11.1
*/
public function close()
{
if ($this->_state !== 'active')
{
// @TODO :: generated error here
return false;
}
$session = JFactory::getSession();
$data = $session->getData();
// Before storing it, let's serialize and encode the JRegistry object
$_SESSION['joomla'] = base64_encode(serialize($data));
session_write_close();
return true;
}
/**
* Set session cookie parameters
@@ -1205,10 +1205,13 @@ public function save($data)
{
$associations = $data['associations'];
// Unset any invalid associations
$associations = Joomla\Utilities\ArrayHelper::toInteger($associations);
// Unset any invalid associations
foreach ($associations as $tag => $id)
{
if (!(int) $id)
if (!$id)
{
unset($associations[$tag]);
}
@@ -1244,7 +1247,7 @@ public function save($data)
foreach ($associations as $id)
{
$query->values($id . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
$query->values(((int) $id) . ',' . $db->quote($this->associationsContext) . ',' . $db->quote($key));
}
$db->setQuery($query);
@@ -393,7 +393,7 @@ protected function displaySession($key = '', $session = null, $id = 0)
{
if (!$session)
{
$session = $_SESSION;
$session = JFactory::getSession()->getData();
}
$html = array();

0 comments on commit 2cd4ef6

Please sign in to comment.