Permalink
Browse files

Synchronizing with symfony svn

  • Loading branch information...
1 parent e5c5051 commit aa7e9e4951f5e8213af9614d4d5cf3e63ba3c73c @vjousse committed Sep 16, 2011
View
11 CHANGELOG
@@ -1,3 +1,14 @@
+09/16/11: Version 1.4.14
+------------------------
+
+ * [33025] fixed sfCacheSessionStorage does not always check whether HTTP_USER_AGENT is set (closes #9921, patch from boutell)
+ * [33022] fixed auto_link_text() when an email address is already linked (closes #9915, based on a patch from klemens_u)
+ * [33021] fixed sfCacheSessionStorage does not serialize properly, also uses wrong option name for httponly (closes #9919, based on a patch from boutell)
+ * [32939] fixed memory leak in sfRoute::generate() (closes #9886 - patch from acf0)
+ * [32892] fixed Doctrine form generation when a schema has abstract tables (closes #9885 - patch from chok)
+ * [32891] fixed sfFinder bug when mirroring file with twice the path inside it (closes #9892 - based on a patch from shordeaux)
+ * [32890] fixed bad value of property 'list-style' in css of WebDebug toolbar (closes #9891 - patch from tomi)
+
08/05/11: Version 1.4.13
------------------------
View
2 lib/autoload/sfCoreAutoload.class.php
@@ -11,7 +11,7 @@
/**
* The current symfony version.
*/
-define('SYMFONY_VERSION', '1.4.14-DEV');
+define('SYMFONY_VERSION', '1.4.15-DEV');
/**
* sfCoreAutoload class.
View
9 lib/helper/TextHelper.php
@@ -16,7 +16,7 @@
* @subpackage helper
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author David Heinemeier Hansson
- * @version SVN: $Id: TextHelper.php 31895 2011-01-24 18:37:43Z fabien $
+ * @version SVN: $Id: TextHelper.php 33022 2011-09-15 05:27:12Z fabien $
*/
/**
@@ -283,5 +283,10 @@ function _auto_link_urls($text, $href_options = array(), $truncate = false, $tru
*/
function _auto_link_email_addresses($text)
{
- return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '<a href="mailto:\\1">\\1</a>', $text);
+ // Taken from http://snippets.dzone.com/posts/show/6156
+ return preg_replace("#(^|[\n ])([a-z0-9&\-_\.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text);
+
+ // Removed since it destroys already linked emails
+ // Example: <a href="mailto:me@example.com">bar</a> gets <a href="mailto:me@example.com">bar</a> gets <a href="mailto:<a href="mailto:me@example.com">bar</a>
+ //return preg_replace('/([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/', '<a href="mailto:\\1">\\1</a>', $text);
}
View
41 lib/storage/sfCacheSessionStorage.class.php
@@ -40,12 +40,20 @@ class sfCacheSessionStorage extends sfStorage
public function initialize($options = array())
{
// initialize parent
+
+ // bc with a slightly different name formerly used here, let's be
+ // compatible with the base class name for it from here on out
+ if (isset($options['session_cookie_http_only']))
+ {
+ $options['session_cookie_httponly'] = $options['session_cookie_http_only'];
+ }
+
parent::initialize(array_merge(array('session_name' => 'sfproject',
'session_cookie_lifetime' => '+30 days',
'session_cookie_path' => '/',
'session_cookie_domain' => null,
'session_cookie_secure' => false,
- 'session_cookie_http_only' => true,
+ 'session_cookie_httponly' => true,
'session_cookie_secret' => 'sf$ecret'), $options));
// create cache instance
@@ -108,14 +116,28 @@ public function initialize($options = array())
$this->options['session_cookie_path'],
$this->options['session_cookie_domain'],
$this->options['session_cookie_secure'],
- $this->options['session_cookie_http_only']);
+ $this->options['session_cookie_httponly']);
$this->data = array();
}
else
{
- // load data from cache
- $this->data = $this->cache->get($this->id, array());
+ // load data from cache. Watch out for the default case. We could
+ // serialize(array()) as the default to the call but that would be a performance hit
+ $raw = $this->cache->get($this->id, null);
+ if (is_null($raw))
+ {
+ $this->data = array();
+ }
+ elseif (is_array($raw))
+ {
+ // probably an old cached value (BC)
+ $this->data = $raw;
+ }
+ else
+ {
+ $this->data = unserialize($raw);
+ }
if(sfConfig::get('sf_logging_enabled'))
{
@@ -208,10 +230,12 @@ public function regenerate($destroy = false)
}
// generate session id
- $this->id = md5(rand(0, 999999).$_SERVER['REMOTE_ADDR'].$_SERVER['HTTP_USER_AGENT'].$this->options['session_cookie_secret']);
+ $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'ua';
+
+ $this->id = md5(rand(0, 999999).$_SERVER['REMOTE_ADDR'].$ua.$this->options['session_cookie_secret']);
// save data to cache
- $this->cache->set($this->id, $this->data);
+ $this->cache->set($this->id, serialize($this->data));
// update session id in signed cookie
$this->response->setCookie($this->options['session_name'],
@@ -220,7 +244,7 @@ public function regenerate($destroy = false)
$this->options['session_cookie_path'],
$this->options['session_cookie_domain'],
$this->options['session_cookie_secure'],
- $this->options['session_cookie_http_only']);
+ $this->options['session_cookie_httponly']);
session_id($this->id);
return true;
}
@@ -249,11 +273,10 @@ public function shutdown()
// only update cache if session has changed
if($this->dataChanged === true)
{
- $this->cache->set($this->id, $this->data);
+ $this->cache->set($this->id, serialize($this->data));
if(sfConfig::get('sf_logging_enabled'))
{
$this->dispatcher->notify(new sfEvent($this, 'application.log', array('Storing session to cache')));
- // $this->dispatcher->notify(new sfEvent($this, 'application.log', array(var_export($this->data, true))));
}
}
}
View
5 test/unit/helper/TextHelperTest.php
@@ -13,7 +13,7 @@
require_once(dirname(__FILE__).'/../../../lib/helper/TagHelper.php');
require_once(dirname(__FILE__).'/../../../lib/helper/TextHelper.php');
-$t = new lime_test(54);
+$t = new lime_test(56);
// truncate_text()
$t->diag('truncate_text()');
@@ -134,4 +134,5 @@
$t->is(auto_link_text('<p>http://www.google.com/?q=symfony+link</p>', 'all', array(), true, 32, '***'), '<p><a href="http://www.google.com/?q=symfony+link">http://www.google.com/?q=symfony***</a></p>', 'auto_link_text() takes truncation parameters');
$t->is(auto_link_text('<p>http://twitter.com/#!/fabpot</p>'),'<p><a href="http://twitter.com/#!/fabpot">http://twitter.com/#!/fabpot</a></p>',"auto_link_text() converts URLs with complex fragments to links");
$t->is(auto_link_text('<p>http://twitter.com/#!/fabpot is Fabien Potencier on Twitter</p>'),'<p><a href="http://twitter.com/#!/fabpot">http://twitter.com/#!/fabpot</a> is Fabien Potencier on Twitter</p>',"auto_link_text() converts URLs with complex fragments and trailing text to links");
-
+$t->is(auto_link_text('hello '.$email_result, 'email_addresses'), 'hello '.$email_result, "auto_link_text() does not double-link emails");
+$t->is(auto_link_text('<p>Link '.$link_result.'</p>'), '<p>Link '.$link_result.'</p>', "auto_link_text() does not double-link emails");
View
2 test/unit/widget/i18n/sfWidgetFormI18nChoiceCountryTest.php
@@ -41,7 +41,7 @@
// Test for ICU Upgrade and Ticket #7988
// should be 0. Tests will break after ICU Update, which is fine. change count to 0
$t->is(count($css->matchAll('#country option[value="ZZ"]')), 1, '->render() does not contain dummy data');
-$t->is(count($css->matchAll('#country option[value="419"]')), 1, '->render() does not contain region data');
+$t->is(count($css->matchAll('#country option[value="419"]')), 0, '->render() does not contain region data');
// add_empty
$t->diag('add_empty');

0 comments on commit aa7e9e4

Please sign in to comment.