shumkov/rediska

Rediska Session error

ruflin opened this issue · 11 comments

Sometimes I find the following error in our error log. I'm using Rediska 0.5.6. I wasn't able to reproduce this error on purpose yet. In a way this should not be possible as Rediska_Zend_Session_Set implements ArrayAccess. Do you have an idea how to resolve this issue?

[30-Nov-2011 12:21:53] PHP Fatal error: Cannot use object of type Rediska_Zend_Session_Set as array in ../libs/Rediska/Zend/Session/SaveHandler/Redis.php on line 137

till commented

Maybe this is a problem with your PHP version?

Our php version is 5.3.8. I googled for this issue with ArrayAccess and PHP 5.3. All I found were issues with 5.1, but not really related to this problem. Any other ideas?

till commented

I'm not sure – I googled and found stackoverflow posts discussing issues with ArrayAccess, but I didn't have time to dig into it. It seems like the issues reported with 5.1 are probably still present today. If I'm not mistaken, we could easily stop using ArrayAccess too. It's more or less a convenience API. Maybe I'm wrong.

Maybe @shumkov can weigh in.

Attaching some links:
https://github.com/Shumkov/Rediska/blob/master/library/Rediska/Zend/Session/SaveHandler/Redis.php#L137
https://github.com/Shumkov/Rediska/blob/master/library/Rediska/Key/SortedSet.php#L263-L267

I also checked all the reports on stackoverflow. But all are related to PHP 5.1 and nested arrays. There still seems to be a nested/multidimensional array issue with ArrayAccess, but in the case here it is just a simple 1 dimensional array access.

Strange is also, that it happens only once or twice in more than 100'000 Redis requests ...

i think you have to look this php bug https://bugs.php.net/bug.php?id=34783

till commented

I think we should drop ArrayAccess. Would anyone like to work on a pull request?

Only you! :)

till commented

If ppl update to 5.3.4+ this should work: http://docs.php.net/manual/en/arrayaccess.offsetget.php

I still have this problem with PHP 5.3.14 it seems related to APC
http://stackoverflow.com/questions/7283604/php-apc-zend-classes-cannot-be-found
I didn't find any solution

till commented

Different issue – this is not a support forum. ;-)

I replied on the stackoverflow question.

the problem was exactly the same reported in this thread, anyway thank you very much for the solution!