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

[3.8.6] Session handler apc not available with PHP >= 7.0 #19940

Closed
ghost opened this issue Mar 19, 2018 · 4 comments
Closed

[3.8.6] Session handler apc not available with PHP >= 7.0 #19940

ghost opened this issue Mar 19, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Mar 19, 2018

Hello,

I am not really new with Joomla!. But this is my first issue here and also the first time that I am contributing to this project.
So I am sorry for my bad English and please be patiently with me if I get something wrong.

It's not possible to choose apc as session handler if you are running php >= 7.0
I think this is caused by libraries/vendor/joomla/session/Joomla/Session/Storage/Apc.php,
which this function has for detecting apc/apcu:

public static function isSupported()
        {
                return extension_loaded('apc');
        }

To support php >= 7.0 it should be:

public static function isSupported()
        {
                return extension_loaded('apcu');
        }

Or we need an extra handler like already done in Joomla 4 with libraries/vendor/joomla/session/src/Handler/ApcHandler.php

Best regards
Felix

@ghost ghost changed the title Session handler apc not available with PHP >= 7.0 [3.8.6]Session handler apc not available with PHP >= 7.0 Mar 19, 2018
@ghost ghost changed the title [3.8.6]Session handler apc not available with PHP >= 7.0 [3.8.6] Session handler apc not available with PHP >= 7.0 Mar 19, 2018
@mbabker
Copy link
Contributor

mbabker commented Mar 19, 2018

PHP's ext/apc and ext/apcu are two separate things, so yes, a separate handler for the APCu extension would be needed to work specifically with the newer APCu extension.

The original APC extension was in essence deprecated and abandoned at PHP 5.5 in favor of OPCache and APCu became the de facto continuation of this. IIRC there is still an apcu-bc package on PECL that can proxy the old apc_* functions to apcu_* but even that would never make the extension_loaded('apc') check pass.

@ghost
Copy link
Author

ghost commented Mar 19, 2018

Thanks for the quick answer. So I guess this will be little bit more complicated as I thought.
I have a few question, to understand the whole thing.

As far as I understand, we do need new handler, because all apc_*functions need to be rewritten in to apcu_* . As far as I know they should have a quite similar syntax or even the same?
The new handler need also to check apcu by extension_loaded('apcu').

Would we really need two handler apc and apcu? Why not only support apcu, if apc is deprecated? Is this to be compatible with PHP < 5.5?

@mbabker
Copy link
Contributor

mbabker commented Mar 19, 2018

The APC handler has been there for a long time, and will be dropped in 4.0 since support for that extension is dead. We just never got around to adding an APCu handler in the session API (it was done for the cache API though). And as you found, in the Framework's Session package we did clean things up and make a proper APCu handler.

So honestly it's just one of those things where nobody did the work to add that support.

Would we really need two handler apc and apcu? Why not only support apcu, if apc is deprecated? Is this to be compatible with PHP < 5.5?

If I'm not mistaken PHP's ext/apc is only supported on PHP 5.3 and 5.4, while ext/apcu is PHP 5.5+. IIRC there's also an extension on PECL that can bridge APC to APCu on PHP 5 (maybe even "trick" the extension_loaded() check) but I don't recall if that extension works on PHP 7. Either way migrating APC to APCu is the right course of action, this is just the one area it wasn't done in for whatever reason.

@mbabker
Copy link
Contributor

mbabker commented Mar 25, 2018

See #19990

@mbabker mbabker closed this as completed Mar 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants