-
Notifications
You must be signed in to change notification settings - Fork 62
Conversation
Got following errrors under php 7.2:
|
.travis.yml
Outdated
env: | ||
- DEPS=latest | ||
allow_failures: | ||
- php: nightly | ||
- php: 7.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if I am right, but somewhere, someone secretly decided to not allow failures on PHP 7.2 any more ;-)
@froschdesign Is it right? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samsonasik and @webimpress
November 30, 2017 is around the corner therefore it make no sense! 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@webimpress @froschdesign I've removed allow_failures->php 7.2, do you think we need to keep the "nightly"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samsonasik I wouldn't do that as long as we don't have PHP 7.3-alpha yet.
So, any suggestion to get the error gone in php 7.2 ? |
@samsonasik I'd suggest to try
|
@samsonasik Hm... oh, no... sorry. No idea for now. This is not gonna work. |
Same issue from Fedora QA |
apply php 7.2 to travis
This is a case where the tests are incorrect; the value "user" was never correct, but previous versions of PHP did not raise an error. I'll update to provide a mock |
This patch takes the following approach: - If "files" is provided in _any_ PHP version, it continues to use `ini_set`. - If "user" is provided in PHP versions prior to 7.2, it continues to use `ini_set`. - Otherwise, it checks to see if the handler provided is a class or instance that implements PHP's `SessionHandlerInterface`; if so, it uses `session_set_save_handler()` with that instance (instantiating it if it is a class name). - It no longer uses `ini_get()` to retrieve the save handler configuration _unless_ it has not been memoized in the instance. This approach works cross-platform.
*/ | ||
public function setSaveHandler($phpSaveHandler) | ||
{ | ||
// error_log(sprintf('In %s with %s', __METHOD__, var_export($phpSaveHandler, true))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this comment above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove; thanks!
src/SessionManager.php
Outdated
// ArrayUtils::merge parameter | ||
if ($oldSessionData instanceof Storage\StorageInterface) { | ||
$oldSessionData = $oldSessionData->toArray(); | ||
} elseif ($oldSessionData instanceof \Traversable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traversable
is imported
src/SessionManager.php
Outdated
if ($oldSessionData instanceof Storage\StorageInterface) { | ||
$oldSessionData = $oldSessionData->toArray(); | ||
} elseif ($oldSessionData instanceof \Traversable) { | ||
$oldSessionData = iterator_to_array($oldSessionData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it is sufficient - because it is not recursive.
src/SessionManager.php
Outdated
if ($oldSessionData instanceof \Traversable | ||
|| (! empty($oldSessionData) && is_array($oldSessionData)) | ||
) { | ||
if ($oldSessionData instanceof Traversable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As noted by @Xerkus in separate PR this is no longer needed
src/SessionManager.php
Outdated
$oldSessionData = $oldSessionData->toArray(); | ||
} | ||
|
||
if (! empty($oldSessionData) && is_array($oldSessionData)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
! empty
is useless
37571c5
to
76d30d7
Compare
- PHP 7+ environments have it by default, but it's out-of-date - PHP 5 environments have ext/mongo but not ext/mongodb, so we need to install it. `pecl upgrade` will install if it's not present, and upgrade otherwise. Once installed, we need to enable it if it is not already.
76d30d7
to
69eb479
Compare
Test case fails on PHP 7.2 due to headers being sent; run in separate process.
Single test failure is on 5.6-locked, where the MongoDb SaveHandler implementation's garbage collection test reliably fails; passes on all other environments, however, so I'm going to take it as a pass. |
Thanks, @samsonasik, for getting this started! |
Per zendframework#97, the fix in 2.8.1 (provided by zendframework#92) for having `SessionConfig::setPhpSaveHandler()` work with PHP 7.2 was too aggressive, and prevented the ability to set the value to a known extension, such as redis. This patch fixes that approach by grabbing a list of known save handlers from `phpinfo()` (after first stripping `user` from the list), and comparing the incoming value to that list; if it is in that list, it now uses `session_module_name()` to set the value. Tests for this are next to impossible to write, unfortunately, as we would need to have multiple extensions installed on developer machines and in Travis. I have instead added tests verifying the various exceptions thrown, including one thrown when a value is in the known PHP save handlers list, but fails to be set properly.
No description provided.