Re: Cache / file.php / unserialize() error
This should be fixed in #769 http://cakephp.lighthouseapp.com/projects/42648/tickets/769 We're working towards packaging another release for this as soon as possible. Cheers, Graham Weldon (AKA: Predominant) On Wed, Jun 2, 2010 at 5:38 AM, Brent wrote: > Hello, > > I installed CakePHP 1.3.1 and a CMS app named Croogo on my Solaris > server. Loading pages produces errors like this one: > > > Notice (8): unserialize() [function.unserialize]: Error at offset 5 of > 602 bytes [CORE/cake/libs/cache/file.php, line 176] > Code | Context > > $key = "cake_core_file_map" > $time = 1275420867 > $cachetime = 1275420872 > $data = > "a:3:{s:4:\"Core\";a:3:{s:6:\"Router\";s:32:\"/www/croogo/cake/ > libs/router.php\";s:13:\"ClassRegistry\";s:40:\"/www/croogo/cake/libs/ > class_registry.php\";s:12:\"Overloadable\";s:38:\"/www/croogo/cake/ > libs/overloadable.php\";}s:10:\"Controller\";a:2:{s:9:\"Component\";s: > 46:\"/www/croogo/cake/libs/controller/component.php\";s:10:\"Controller > \";s:47:\"/www/croogo/cake/libs/controller/controller.php\";}s:4:\"View > \";a:3:{s:6:\"Helper\";s:37:\"/www/croogo/cake/libs/view/helper.php > \";s:4:\"View\";s:35:\"/www/croogo/cake/libs/view/view.php\";s: > 5:\"Media\";s:36:\"/www/croogo/cake/libs/view/media.php\";}} > " > > unserialize - [internal], line ?? > FileEngine::read() - CORE/cake/libs/cache/file.php, line 176 > Cache::read() - CORE/cake/libs/cache.php, line 347 > App::getInstance() - CORE/cake/libs/configure.php, line 967 > App::build() - CORE/cake/libs/configure.php, line 650 > Configure::__loadBootstrap() - CORE/cake/libs/configure.php, line 431 > Configure::getInstance() - CORE/cake/libs/configure.php, line 52 > include - CORE/cake/bootstrap.php, line 38 > [main] - APP/webroot/index.php, line 76 > > > What can I do to fix it? > > Many thanks, > Brent > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Cache / file.php / unserialize() error
Hello, I installed CakePHP 1.3.1 and a CMS app named Croogo on my Solaris server. Loading pages produces errors like this one: Notice (8): unserialize() [function.unserialize]: Error at offset 5 of 602 bytes [CORE/cake/libs/cache/file.php, line 176] Code | Context $key= "cake_core_file_map" $time = 1275420867 $cachetime = 1275420872 $data = "a:3:{s:4:\"Core\";a:3:{s:6:\"Router\";s:32:\"/www/croogo/cake/ libs/router.php\";s:13:\"ClassRegistry\";s:40:\"/www/croogo/cake/libs/ class_registry.php\";s:12:\"Overloadable\";s:38:\"/www/croogo/cake/ libs/overloadable.php\";}s:10:\"Controller\";a:2:{s:9:\"Component\";s: 46:\"/www/croogo/cake/libs/controller/component.php\";s:10:\"Controller \";s:47:\"/www/croogo/cake/libs/controller/controller.php\";}s:4:\"View \";a:3:{s:6:\"Helper\";s:37:\"/www/croogo/cake/libs/view/helper.php \";s:4:\"View\";s:35:\"/www/croogo/cake/libs/view/view.php\";s: 5:\"Media\";s:36:\"/www/croogo/cake/libs/view/media.php\";}} " unserialize - [internal], line ?? FileEngine::read() - CORE/cake/libs/cache/file.php, line 176 Cache::read() - CORE/cake/libs/cache.php, line 347 App::getInstance() - CORE/cake/libs/configure.php, line 967 App::build() - CORE/cake/libs/configure.php, line 650 Configure::__loadBootstrap() - CORE/cake/libs/configure.php, line 431 Configure::getInstance() - CORE/cake/libs/configure.php, line 52 include - CORE/cake/bootstrap.php, line 38 [main] - APP/webroot/index.php, line 76 What can I do to fix it? Many thanks, Brent Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: unserialize error
hey, session data are serialized. i failed with php command "unserialize", because of the "|" signs, which apparently separate subarrays. i found no other way of getting the data out of the session. see this example: $account_in_use = false; $temp = mysql_query('SELECT * FROM sessions'); while($row = mysql_fetch_array($temp)){ $vars = array(); $a = preg_split( "/(\w+)\|/", $row['data'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); for($i = 0; $i < count($a); $i = $i+2){ $vars[$a[$i]] = unserialize($a[$i+1]); } if(isset($vars['User']['id']) && isset($vars['User'] ['logged_in'])){ if($vars['User']['id']==$someone['User']['id'] && $vars['User'] ['logged_in']==1){ $account_in_use = true; break; } } } this piece of code helps checking for the logged_in status. i'm wondering if you have usernames only in the sessions ? can you read the usernames from another table, which is related to the session entry ? i would have been better of storing the logged_in status in another table... but anyways, it works for now... regards, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [EMAIL PROTECTED] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unserialize error
gc works fine now, How to extract some value from $session['Mysession']['data'] like User.username ? I would like to find all logged users (by username). () without stuff like: $a = preg_split( "/(\w+)\|/", $row['data'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); Is there another way? On Apr 7, 1:55 pm, "jyrgen" <[EMAIL PROTECTED]> wrote: > finally i found a way to implement a custom > session garbage collection. luckily there > is the "expires" field which can be evaluated > instead of the serialized value in the data array: > > // custom session garbage collection > > $sessions = $this->Mysession->findAll(); > foreach($sessions as $session){ > if($session['Mysession']['expires'] $this->Mysession->del($session['Mysession']['id']); > } > } > > use the mysession model i posted above. > > majna, wasn't it this what you have been looking for ? > > cheers, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unserialize error
finally i found a way to implement a custom session garbage collection. luckily there is the "expires" field which can be evaluated instead of the serialized value in the data array: // custom session garbage collection $sessions = $this->Mysession->findAll(); foreach($sessions as $session){ if($session['Mysession']['expires']Mysession->del($session['Mysession']['id']); } } use the mysession model i posted above. majna, wasn't it this what you have been looking for ? cheers, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unserialize error
valid sessions on my system look like this Config|a:3:{s:4:"rand";i:1735136669;s:4:"time";i:1175943092;s: 9:"userAgent";s:32:"cc98eaffc23c634e0efd75ab9e36e810";} User|a:5:{s:2:"id";s:1:"6";s:9:"author_id";s:1:"5";s: 12:"publisher_id";s:1:"0";s:9:"logged_in";i:1;s:4:"type";s:1:"A";} (two arrays) i'm asking myself if the "|", lets my reading fail... this works for my, instead of unserialize: $temp = mysql_query('SELECT * FROM sessions'); while ($row = mysql_fetch_array($temp)){ $variables = array( ); $a = preg_split( "/(\w+)\|/", $row['data'], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); for( $i = 0; $i < count( $a ); $i = $i+2 ) { $variables[$a[$i]] = unserialize( $a[$i+1] ); } } should be combined with a session model in order to avoid explicit sql quering. i can live with that :-) still searching for a method to collect session garbage. once i got this done, multiple logins are prevented and my auth system will be finished... cheers, jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unserialize error
Also I need to grab username from session. Sessions are set to database. Cake 1.1.13. Session data filed is NOT just serilalized. Is there any other way beside reg exp? On Apr 7, 12:22 pm, "jyrgen" <[EMAIL PROTECTED]> wrote: > i'm still struggling with reading data from the sessions > table. > > at least i'm now able to retrieve session entries, after > i set up a simple model like this. > > class Session extends AppModel{ > var $name = 'Session'; > } > > but when i try to print out the session data in a controller > > $sessions = $this->Session->findAll(); > foreach($sessions as $session){ > $d=$session['Session']['data']; > pr(unserialize($d)); > } > > i get this error: > > Notice: unserialize(): Error at offset 0 of 117 bytes in /var/www/cake/ > app/controllers/users_controller.php on line 88 > > with 117 being the last position "}" of the serialized string > > Config|a:3:{s:4:"rand";i:1024300043;s:4:"time";i:1175942427;s: > 9:"userAgent";s:32:"cc98eaffc23c634e0efd75ab9e36e810";} > > thanks for your help! > > jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: unserialize error
oops. i just noticed that the Session model interferes with the Session object. therefore i renamed the Session model into mysession.php class Mysession extends AppModel{ var $name = 'Mysession'; var $useTable = 'sessions'; } j. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
unserialize error
i'm still struggling with reading data from the sessions table. at least i'm now able to retrieve session entries, after i set up a simple model like this. class Session extends AppModel{ var $name = 'Session'; } but when i try to print out the session data in a controller $sessions = $this->Session->findAll(); foreach($sessions as $session){ $d=$session['Session']['data']; pr(unserialize($d)); } i get this error: Notice: unserialize(): Error at offset 0 of 117 bytes in /var/www/cake/ app/controllers/users_controller.php on line 88 with 117 being the last position "}" of the serialized string Config|a:3:{s:4:"rand";i:1024300043;s:4:"time";i:1175942427;s: 9:"userAgent";s:32:"cc98eaffc23c634e0efd75ab9e36e810";} thanks for your help! jyrgen --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---