Giter Club home page Giter Club logo

Comments (7)

rkyoku avatar rkyoku commented on August 20, 2024

Here is the trace:

#0  MyProject\App->allThrowErrorHandler(2, ini_set() [function.ini-set]: A session is active. You cannot change the session module's ini settings at this time, D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Phpfunc.php, 33, Array ([func] => ini_set,[args] => Array ([0] => session.use_trans_sid,[1] => 0)))
#1  ini_set(session.use_trans_sid, 0)
#2  call_user_func_array(ini_set, Array ([0] => session.use_trans_sid,[1] => 0)) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Phpfunc.php:33]
#3  Aura\Session\Phpfunc->__call(ini_set, Array ([0] => session.use_trans_sid,[1] => 0))
#4  Aura\Session\Phpfunc->ini_set(session.use_trans_sid, 0) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Session.php:260]
#5  Aura\Session\Session->sessionStatus() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Session.php:228]
#6  Aura\Session\Session->isStarted() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Segment.php:227]
#7  Aura\Session\Segment->resumeSession() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\aura\session\src\Segment.php:66]
#8  Aura\Session\Segment->get(member_id) called at [D:\dev\wamp2.2\www\MyProject\app\App.php:136]
#9  MyProject\App->isLogged() called at [D:\dev\wamp2.2\www\MyProject\app\controller\AController.php:77]
#10 MyProject\Controller\AController->needLogged() called at [D:\dev\wamp2.2\www\MyProject\app\controller\AController.php:339]
#11 MyProject\Controller\AController::__callStatic(route_homepage, Array ())
#12 MyProject\Controller\MainController::route_homepage() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:197]
#13 flight\core\Dispatcher::invokeMethod(Array ([0] => MyProject\Controller\MainController,[1] => route_homepage), Array ()) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:142]
#14 flight\core\Dispatcher::execute(Array ([0] => MyProject\Controller\MainController,[1] => route_homepage), Array ()) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\Engine.php:313]
#15 flight\Engine->_start() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:196]
#16 flight\core\Dispatcher::invokeMethod([long params]) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:142]
#17 flight\core\Dispatcher::execute([long params]) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:48]
#18 flight\core\Dispatcher->run(start, Array ()) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\Engine.php:64]
#19 flight\Engine->__call(start, Array ())
#20 flight\Engine->start() called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\core\Dispatcher.php:196]
#21 flight\core\Dispatcher::invokeMethod([long params]) called at [D:\dev\wamp2.2\www\MyProject\lib\vendor\mikecao\flight\flight\Flight.php:76]
#22 Flight::__callStatic(start, Array ())
#23 Flight::start() called at [D:\dev\wamp2.2\www\MyProject\app\App.php:118]
#24 MyProject\App->route() called at [D:\dev\wamp2.2\www\MyProject\public\webapp.php:81]

I suspect it is due to how Flight handles the session or something, because it only emits a warning after I have called Flight::start().

Should I be on the lookout for something in particular? Like a session_start or something, maybe? Anyway I obviously need to be able to use the session after the call to AController::__callStatic(route_***), but it seems to bug at this moment.

from aura.session.

rkyoku avatar rkyoku commented on August 20, 2024

By the way, I am using PHP 5.3.13.

For now, I am simply ignoring the error in my error handler (by testing the error message with strpos), but I'd love to understand the bottom of it and do things properly... :)

from aura.session.

harikt avatar harikt commented on August 20, 2024

Hi,

This is actually a work around to see if the session is started in 5.3 . See

if ($this->phpfunc->function_exists('session_status')) {
$started = $this->phpfunc->session_status() === PHP_SESSION_ACTIVE;
} else {
$started = $this->sessionStatus();
}

As you mentioned it is already written here

/**
*
* Returns the session status.
*
* Nota bene:
*
* PHP 5.3 implementation of session_status() for only active/none.
* Relies on the fact that ini setting 'session.use_trans_sid' cannot be
* changed when a session is active.
*
* PHP ini_set() raises a warning when we attempt to change this setting
* and session is active. Note that the attempted change is to the
* pre-existing value, so nothing will actually change on success.
*
*/
.

Regarding the error reported : I have tested via https://3v4l.org/5LtnA and https://3v4l.org/PdqkL .

The first one is disabling the error_report and the 2nd one is without disabling the error. You can see the first one have not reported any errors and works perfectly as expected. So your case is 2nd one.

I am not sure what is the problem though in your system.

Could you just try this

<?php
session_start();

$setting = 'session.use_trans_sid';
$current = ini_get($setting);
$level   = error_reporting(0);
$result  = ini_set($setting, $current);
error_reporting($level);

var_dump($result !== $current);

My assumption is the error_reporting is not getting turned off even after it is called.

Thank you.

from aura.session.

rkyoku avatar rkyoku commented on August 20, 2024

Hi,

It works.

But try that one:

<?php
session_start();
$setting = 'session.use_trans_sid';
$current = ini_get($setting);
$level   = error_reporting(0);
$result  = ini_set($setting, $current);
error_reporting($level);

echo 'test1<br>';
var_dump($result !== $current);




function toto($errNo, $errStr, $errFile, $errLine)
{
    die('erreur detected: ' . $errNo . ' // ' . $errStr . ' // ' . $errFile . ' // ' . $errLine);
}
set_error_handler('toto');




$setting = 'session.use_trans_sid';
$current = ini_get($setting);
$level   = error_reporting(0);
$result  = ini_set($setting, $current);
error_reporting($level);

echo 'test2<br>';
var_dump($result !== $current);

die('end');

This is my code (well, kindof), and it fails (it dies).

from aura.session.

harikt avatar harikt commented on August 20, 2024

Hm...

That actually brings me to here :

error_reporting() settings will have no effect and your error handler will be called regardless

http://php.net/set_error_handler

We may want to fix something in that case... But there is a but for php 5.3 already is EOL . So do we really need to spend the time to fix ? I guess there will be less users effected with this though. I know that may be a bit hard for you. Sorry :-( .

If you have any fix, please do send the same. I will also look if we can fix it by some means.

Thank you

from aura.session.

rkyoku avatar rkyoku commented on August 20, 2024

Don't apologize to me, I totally understand. I work on a project for a client who is not capable of installing a newer PHP version on a brand new server (lazy people...). It causes me troubles, obviously, but it is my burden to bear.

I'll just ignore the error in my handler, and it will be ok. As for a fix in the lib itself, I really don't know and I agree that you shouldn't care about PHP 5.3!

Thanks for a very nice lib :)

from aura.session.

harikt avatar harikt commented on August 20, 2024

@RenaudParis

I really don't know and I agree that you shouldn't care about PHP 5.3!

I understand :-) .

from aura.session.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.