•  » Engine
  •  » [resolved] Session storage system

#1 2013-01-19 14:07:28

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

[resolved] Session storage system

Hi,

I spent 3 hours trying to figure out why http://hybridauth.sourceforge.net/ didn't work with Piwigo

first I forgot that Piwigo change the session name
then I forgot that Piwigo store the session in the database

And after fixing all that, things still not work !!!

I dump all the session variable many time before realized that the return value from the database was corrupted (HybridAuth stores a complex serialized array in the session)

And I found that it's Piwigo which corrupt the datas : in functions_session.inc.php, function pwg_session_write()
datas are protected with str_replace("'", "\'", $data), I replaced it with pwg_db_real_escape_string($data) and miracle, all that stuff work !

was there a good reason to not use real_escape_string ?

Offline

 

#2 2013-01-19 21:18:15

nicolas
Former Piwigo Team
2004-12-30
1234

Re: [resolved] Session storage system

mistic100 wrote:

And I found that it's Piwigo which corrupt the datas : in functions_session.inc.php, function pwg_session_write()
datas are protected with str_replace("'", "\'", $data), I replaced it with pwg_db_real_escape_string($data) and miracle, all that stuff work !

was there a good reason to not use real_escape_string ?

You're right, data must be escaped with mysql_real_escape_string. I didn't remember why this had not been done.
But you introduce the ugly str_replace : http://piwigo.org/dev/changeset/12767/t … on.inc.php

Offline

 

#3 2013-01-19 21:30:37

mistic100
Former Piwigo Team
Lyon (FR)
2008-09-27
3277

Re: [resolved] Session storage system

:facepalm to myself:

Offline

 
  •  » Engine
  •  » [resolved] Session storage system

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2025 · Contact