Skip to content
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

[SESSION] Configuration is not correct #314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

[SESSION] Configuration is not correct #314

wants to merge 1 commit into from

Conversation

Plopix
Copy link
Contributor

@Plopix Plopix commented Aug 5, 2018

This PR associated with: ezsystems/ezpublish-kernel#2410

Define that php.ini is the default configuration.

Then you can update that configuration through env. (current is file by default and that is not possible to override it (cause null value would NOT pass in the if in generic.php)

Also the kernel does not use ezplatform.session.save_path at all, then I am really confused.

It fixes also the save path for redis tcp://

I did not really test live from a from scratch install

@@ -95,9 +92,12 @@ parameters:
# env: HTTPCACHE_PURGE_TYPE
purge_type: local

## Session handler, by default set to file based (instead of ~) in order to be able to use %ezplatform.session.save_path%
# env: SESSION_HANDLER_ID
ezplatform.session.handler_id: session.handler.native_file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

afaik this will break: symfony/symfony-standard@070e53c

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then we have an issue because how would you override this config to "use the php.ini"?
In the link you mentioned they want to use the save_path setup in Symfony.

Here we want to let the php.ini handles the handler and the save_path.

It does not break to me, when both are null then php.ini will be used for both configuration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be a simple thing like this:

if (($value = getenv('SESSION_HANDLER_ID')) !== false) {
    $container->setParameter('ezplatform.session.handler_id', $value ?: null);
}

If all you need is to set it to null via env

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Plopix Or:

diff --git a/app/config/env/generic.php b/app/config/env/generic.php
index 72ccf2be..7e4f69a7 100644
--- a/app/config/env/generic.php
+++ b/app/config/env/generic.php
@@ -69,5 +69,5 @@ if ($value = getenv('LOG_TYPE')) {
 }
 
 if ($value = getenv('SESSION_HANDLER_ID')) {
-    $container->setParameter('ezplatform.session.handler_id', $value);
+    $container->setParameter('ezplatform.session.handler_id', $value === '~' ? null : $value);
 }

@@ -43,9 +43,6 @@ parameters:
# using EzSystemsPlatformHttpCacheBundle (default as of v1.12) which by design expires affected cache on changes
httpcache_default_ttl: '%env(HTTPCACHE_DEFAULT_TTL)%'

# Session save path as used by symfony session handlers (eg. used for dsn with redis)
ezplatform.session.save_path: '%env(SESSION_SAVE_PATH)%'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this moved to generic.php?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent.

Copy link
Contributor

@andrerom andrerom Aug 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But that is in-consistent ;) Only params for handlers are done there now, as they can't be done at runtime.

@andrerom
Copy link
Contributor

andrerom commented Aug 6, 2018

Also the kernel does not use ezplatform.session.save_path at all, then I am really confused.

kernel does not need to hard code usage of it, it's passed on to symfony here:https://github.com/ezsystems/ezplatform/blob/master/app/config/config.yml#L68-L69

@Plopix
Copy link
Contributor Author

Plopix commented Aug 6, 2018

About your last comment, as mentioned here: ezsystems/ezpublish-kernel#2410

The kernel does NOT use the ezplatform.session.save_path and it should be according to that:
https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml#L249

@andrerom, Am I completely mistaking here?

@andrerom
Copy link
Contributor

andrerom commented Aug 7, 2018

The kernel does NOT use the ezplatform.session.save_path and it should be according to that:
https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Bundle/EzPublishCoreBundle/Resources/config/services.yml#L249

The intention of this code is to get the param from Symfony framework config, which in turn should have been set by the param.

@Plopix
Copy link
Contributor Author

Plopix commented Aug 8, 2018

Oh right, there is an automated injection of a parameter "session.save_path" by symfony: https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php#L772
I did not know!

I closed the other PR, this one still has sense, right?

@andrerom
Copy link
Contributor

andrerom commented Aug 9, 2018

I closed the other PR, this one still has sense, right?

Partly yes, but please get rid of the non bug related changes.

@@ -105,7 +105,7 @@
}

$container->setParameter('ezplatform.session.handler_id', 'ezplatform.core.session.handler.native_redis');
$container->setParameter('ezplatform.session.save_path', sprintf('%s:%d', $endpoint['host'], $endpoint['port']));
$container->setParameter('ezplatform.session.save_path', sprintf('tcp://%s:%d', $endpoint['host'], $endpoint['port']));
Copy link
Member

@vidarl vidarl Aug 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works without 'tcp://' too right?
Cause it won't work with memcached if we hardcode tcp://

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, so maybe better to keep it as is then so we use same on SESSION_SAVE_PATH usage as on p.sh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants