Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
RELEASE_1_4_19 => v1.4.19 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
pylebecq committed Oct 24, 2012
1 parent e6b27a8 commit 71bd1fb
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 21 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
CHANGELOG
=========

10/09/12: Versions 1.4.19
-------------------------

* [33545] fixed sfPDOSessionStorage for Oracle (closes #10022)
* [33544] fixed sfWebRequest::splitHttpAcceptHeader incorrect result order (closes #10069, patch by Keri Henare)
* [33539] fixed exception format when using the PHP 5.4 built-in server (closes #10067, based on a patch from jgskin)
* [33486] fixed sfPDODatabase::call() method (closes #10044)

05/30/12: Versions 1.4.18
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion lib/autoload/sfCoreAutoload.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* The current symfony version.
*/
define('SYMFONY_VERSION', '1.4.18');
define('SYMFONY_VERSION', '1.4.19');

/**
* sfCoreAutoload class.
Expand Down
4 changes: 2 additions & 2 deletions lib/controller/sfController.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @subpackage controller
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @version SVN: $Id: sfController.class.php 30912 2010-09-15 11:10:46Z fabien $
* @version SVN: $Id: sfController.class.php 33539 2012-09-19 05:36:02Z fabien $
*/
abstract class sfController
{
Expand Down Expand Up @@ -489,7 +489,7 @@ public function setRenderMode($mode)
*/
public function inCLI()
{
return 0 == strncasecmp(PHP_SAPI, 'cli', 3);
return 'cli' == PHP_SAPI;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/database/sfPDODatabase.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @author Dustin Whittle <dustin.whittle@symfony-project.com>
* @version SVN: $Id: sfPDODatabase.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
* @version SVN: $Id: sfPDODatabase.class.php 33486 2012-07-09 08:57:29Z fabien $
*/
class sfPDODatabase extends sfDatabase
{
Expand Down Expand Up @@ -109,6 +109,6 @@ public function shutdown()
*/
public function __call($method, $arguments)
{
return $this->getConnection()->$method($arguments);
return call_user_func_array(array($this->getConnection(), $method), $arguments);
}
}
7 changes: 4 additions & 3 deletions lib/exception/sfException.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @subpackage exception
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @version SVN: $Id: sfException.class.php 33214 2011-11-19 13:47:24Z fabien $
* @version SVN: $Id: sfException.class.php 33539 2012-09-19 05:36:02Z fabien $
*/
class sfException extends Exception
{
Expand Down Expand Up @@ -195,8 +195,9 @@ static protected function outputStackTrace(Exception $exception)
}
}

// when using CLI, we force the format to be TXT
if (0 == strncasecmp(PHP_SAPI, 'cli', 3))
// when using CLI, we force the format to be TXT. Compare exactly to
// the string 'cli' because the php 5.4 server is identified by 'cli-server'
if ('cli' == PHP_SAPI)
{
$format = 'txt';
}
Expand Down
22 changes: 14 additions & 8 deletions lib/request/sfWebRequest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @subpackage request
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @version SVN: $Id: sfWebRequest.class.php 32729 2011-07-05 15:23:04Z www-data $
* @version SVN: $Id: sfWebRequest.class.php 33544 2012-10-05 10:42:42Z fabien $
*/
class sfWebRequest extends sfRequest
{
Expand Down Expand Up @@ -633,28 +633,34 @@ public function setRelativeUrlRoot($value)
public function splitHttpAcceptHeader($header)
{
$values = array();
$groups = array();
foreach (array_filter(explode(',', $header)) as $value)
{
// Cut off any q-value that might come after a semi-colon
if ($pos = strpos($value, ';'))
{
$q = (float) trim(substr($value, strpos($value, '=') + 1));
$q = trim(substr($value, strpos($value, '=') + 1));
$value = substr($value, 0, $pos);
}
else
{
$q = 1;
}

if (0 < $q)
{
$values[trim($value)] = $q;
}
$groups[$q][] = $value;
}

arsort($values);
krsort($groups);

foreach ($groups as $q => $items) {
if (0 < $q) {
foreach ($items as $value) {
$values[] = trim($value);
}
}
}

return array_keys($values);
return $values;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/storage/sfPDOSessionStorage.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @author Mathew Toth <developer@poetryleague.com>
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @author Sean Kerr <sean@code-box.org>
* @version SVN: $Id: sfPDOSessionStorage.class.php 13143 2008-11-18 22:22:01Z FabianLange $
* @version SVN: $Id: sfPDOSessionStorage.class.php 33545 2012-10-05 10:49:45Z fabien $
*/
class sfPDOSessionStorage extends sfDatabaseSessionStorage
{
Expand Down Expand Up @@ -115,7 +115,7 @@ public function sessionRead($id)
$sessionRows = $stmt->fetchAll(PDO::FETCH_NUM);
if (count($sessionRows) == 1)
{
return $sessionRows[0][0];
return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0];
}
else
{
Expand Down
7 changes: 4 additions & 3 deletions test/unit/request/sfWebRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

require_once(dirname(__FILE__).'/../../bootstrap/unit.php');

$t = new lime_test(72);
$t = new lime_test(73);

class myRequest extends sfWebRequest
{
Expand Down Expand Up @@ -101,15 +101,16 @@ public function resetPathInfoArray()

$request->acceptableContentTypes = null;
$_SERVER['HTTP_ACCEPT'] = 'text/xml,application/xhtml+xml,application/xml,text/html;q=0.9,text/plain;q=0.8,*/*;q=0.5';
$t->is($request->getAcceptableContentTypes(), array('text/xml', 'application/xml', 'application/xhtml+xml', 'text/html', 'text/plain', '*/*'), '->getAcceptableContentTypes() returns an array with all accepted content types');
$t->is($request->getAcceptableContentTypes(), array('text/xml', 'application/xhtml+xml', 'application/xml', 'text/html', 'text/plain', '*/*'), '->getAcceptableContentTypes() returns an array with all accepted content types');

// ->splitHttpAcceptHeader()
$t->diag('->splitHttpAcceptHeader()');

$t->is($request->splitHttpAcceptHeader(''), array(), '->splitHttpAcceptHeader() returns an empty array if the header is empty');
$t->is($request->splitHttpAcceptHeader('a,b,c'), array('c', 'b', 'a'), '->splitHttpAcceptHeader() returns an array of values');
$t->is($request->splitHttpAcceptHeader('a,b,c'), array('a', 'b', 'c'), '->splitHttpAcceptHeader() returns an array of values');
$t->is($request->splitHttpAcceptHeader('a,b;q=0.7,c;q=0.3'), array('a', 'b', 'c'), '->splitHttpAcceptHeader() strips the q value');
$t->is($request->splitHttpAcceptHeader('a;q=0.1,b,c;q=0.3'), array('b', 'c', 'a'), '->splitHttpAcceptHeader() sorts values by the q value');
$t->is($request->splitHttpAcceptHeader('a;q=0.3,b,c;q=0.3'), array('b', 'a', 'c'), '->splitHttpAcceptHeader() sorts values by the q value including equal values');
$t->is($request->splitHttpAcceptHeader('a; q=0.1, b, c; q=0.3'), array('b', 'c', 'a'), '->splitHttpAcceptHeader() trims whitespaces');
$t->is($request->splitHttpAcceptHeader('a; q=0, b'), array('b'), '->splitHttpAcceptHeader() removes values when q = 0 (as per the RFC)');

Expand Down

0 comments on commit 71bd1fb

Please sign in to comment.