Project

General

Profile

Bug #5877

Replace homemade ChamiloSession and $_SESSION calls with the Silex\Provider\SessionServiceProvider

Added by Julio Montoya over 6 years ago. Updated almost 6 years ago.

Status:
Feature implemented
Priority:
Normal
Assignee:
-
Category:
System
Target version:
Start date:
15/01/2013
Due date:
% Done:

50%

Estimated time:
Complexity:
Difficult
SCRUM pts - complexity:
40

Description

This will help a lot when running phpunit tests.

I've been testing and I have found some warnings due the session

/var/www/chamilo11$ phpunit -c tests/phpunit --filter testIs_username_available
PHPUnit 3.7.12 by Sebastian Bergmann.
Configuration read from /var/www/chamilo11/tests/phpunit/phpunit.xml

E.

Time: 12 seconds, Memory: 17.25Mb

There was 1 error:

1) UserManagerTest::testIs_username_available
session_start(): Cannot send session cookie - headers already sent by (output started at /usr/share/php/PHPUnit/Util/Printer.php:172)

/var/www/chamilo11/main/inc/lib/chamilo_session.class.php:103
/var/www/chamilo11/main/inc/global.inc.php:437
/var/www/chamilo11/tests/phpunit/classes/UserManagerTest.lib.php:19

FAILURES!
Tests: 2, Assertions: 1, Errors: 1.

With the that service provider we could simulate session values

Yeah I know it will be a lot of work ...


Related issues

Related to Chamilo LMS - Feature #4378: improve session destroy removing PHPSESSID from browserNeeds more info13/02/2012

Actions
Related to Chamilo LMS - Feature #6711: Roles in ChamiloNew18/09/2013

Actions

Associated revisions

Revision b324cb06 (diff)
Added by Julio Montoya about 6 years ago

Replacing the ChamiloSession with the SessionServiceProvider see #5877

History

#2

Updated by Julio Montoya over 6 years ago

  • Description updated (diff)
#3

Updated by Julio Montoya over 6 years ago

  • Category set to System
  • Complexity changed from Normal to Difficult
  • SCRUM pts - complexity changed from ? to 40
#4

Updated by Julio Montoya about 6 years ago

  • Status changed from New to Needs testing
  • Priority changed from Low to Normal
  • Target version set to 2.0
  • % Done changed from 0 to 50

We're using right now 2 session "handlers" the ChamiloSession using calls like Session::get('session_value') and $_SESSION['session_value'];

Now, ChamiloSession is using the $app['session'] which is the same thing like before, but we can use all the benefits of the $app['session'] parameters like setting the session params like this example and using the security roles.

session.storage.options: An array of options that is passed to the constructor of the session.storage service.

In case of the default NativeSessionStorage, the most useful options are:

name: The cookie name (_SESS by default)
id: The session id (null by default)
cookie_lifetime: Cookie lifetime
cookie_path: Cookie path
cookie_domain: Cookie domain
cookie_secure: Cookie secure (HTTPS)
cookie_httponly: Whether the cookie is http only
However, all of these are optional. Sessions last as long as the browser is open. To override this, set the lifetime option.

For a full list of available options, read the PHP official documentation.

session.test: Whether to simulate sessions or not (useful when writing functional tests).


http://silex.sensiolabs.org/doc/providers/session.html
#5

Updated by Julio Montoya almost 6 years ago

  • Status changed from Needs testing to Feature implemented

Also available in: Atom PDF