-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove session from factorydefault or start it when creating instance #12921
Comments
Actually, as you can see, we just use "connect" approach in many adapters if they does not connected yet. So what do you think about check session status? IMO we can remove session from factory default in 4.x branch only. |
To make it working and as a bugfix for now for phalcon 3 - fine. But in phalcon 4 to avoid overhead better just remove it from factory default. |
Cc: @phalcon/framework-team |
Also i would consider thinking about for example memcache adapters and other - do we really need to do let memcache = this->_memcache;
if typeof memcache != "object" {
this->_connect();
let memcache = this->_memcache;
} In every single method? Why just not call _connect one time in |
Refs: #10530 |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
Removing it from 4.x is the best option. |
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
@dschissler well i think you can have calls like call method also when setting service in di in some other syntax right? So loading from some format is good idea. Im just talking about session service, not other things - that right now, current one in FactoryDefault is useless - because you need to START session anyway, and to start it you need to call session method yourself, so most people will just set session service themself or you could get existing one from FactoryDefault and just call start method. Other idea is to just start session after creating class. |
This comment was marked as abuse.
This comment was marked as abuse.
Hi, Is this the expected behavior, which will cause breaking a lot of Phalcon projects upon updating to 3.2 without BC notice in documentation, or Phalcon should start a session by itself on instance construction? I would prefer the second option, with Phalcon starting a session on instance construction, however let's just take a decision and fix or close this issue :) Thanks! :) |
This comment was marked as abuse.
This comment was marked as abuse.
Really? So an issue introduced in 3.2 will be fixed in 4.0? That's at least weird, it should be fixed in 3.2.x if the current behavior is not what it's intended to be. |
This comment was marked as abuse.
This comment was marked as abuse.
Semver has been broken introducing a BC from 3.1 to 3.2, which is forbidden by semver. IF we want to FIX this, 3.2.x should be used to revert the BC. |
This comment was marked as abuse.
This comment was marked as abuse.
See #12918 , I got the same fatal error as I updated Phalcon from 3.1 to 3.2 in a small side Project. About 4.0 we should think whether remove the session start on instance construction. IMHO, I would leave that also in 4.0. |
Vote for pure removal in Phalcon v4 |
@micheleangioni well actually it wasn't due to 3.1 > 3.2 really, it was change in zephir which is causing this error. Right now zephie checks if certain superglobal exists, and if not you have error like this. I think it's better to remove session service in phalcon 4, first people will need to choose their adapter and second they will need to actually start it. |
@Jurigag ok, understood. It seems a honest approach. |
This comment was marked as abuse.
This comment was marked as abuse.
@dschissler i think this idea with StatefulServiceInterface is cool, so any class impelemting when resolving service will start it. @sergeyklay |
Addressed |
Right now having session service in
Phalcon\Di\FactoryDefault
is pointless, because you need to start session instance anyway to make it working properly. So you need to have code like this anyway:If you don't have this and you are using just session from
FactoryDefault
then it won't work properly because it's not started until you will start it by accessing this service and executing start method. Like value after doing$session->set()
will be not available right now when using session fromFactoryDefault
in other request.Or we could change it to just start session on instance construction.
This is somehow related issue - #12918
The text was updated successfully, but these errors were encountered: