Skip to content
This repository has been archived by the owner on May 16, 2018. It is now read-only.

PHP7 is more strict with custom session handlers, DbTable.php does not correctly return true #654

Closed
wants to merge 1 commit into from

Conversation

fc
Copy link

@fc fc commented Dec 7, 2015

It should always return true unless there is an actual error.

… return true even though the session was updated
@fc
Copy link
Author

fc commented Dec 7, 2015

More information: it was triggering this error " Warning: session_write_close(): Failed to write session data (user). Please verify that the current setting of session.save_path is correct (/tmp)" until the write method was adjusted to return true.

@froschdesign
Copy link
Member

Sorry, but I can not found a signed CLA.

}
} catch (Exception $e) {
throw new Zend_Session_SaveHandler_Exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

It is prefferable to include previous exception as well.

@tomasfejfar
Copy link
Contributor

@froschdesign can we do something about this?

@zerocrates
Copy link

As I mentioned in #665, I think the best choice here is to simply fix the return value and always return true in write.

The rest of this PR that catches the exceptions and re-throws with a Session component exception might be nice, but it's really addressing something unrelated. I think it's best to just make the minimal necessary change.

@yaronel
Copy link

yaronel commented Oct 6, 2016

What is going on with this bug?
I upgraded to PHP7 and ever since I keep hitting this error because I have a bunch of ajax requests going out at the same time.
It was a pain to even figure out that this is the cause.

Is there a fix for this issue in an official release?

Thanks.

@zerocrates
Copy link

As @froschdesign would say:

We are sorry, but ZF1 reaches its End of Life (EOL).

The simplest workaround is to write your own class that extends from the DbTable handler, and override the write method with one that just calls parent::write() and then returns true.

@yaronel
Copy link

yaronel commented Oct 6, 2016

OK, fair enough.
Thanks for the advice.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants