Hi Ralph,

you'll get NULL characters in your serialized string, when you serialize 
objects containing private or protected member variables...

Best regards

Stefan

-----Ursprüngliche Nachricht-----
Von: Ralph Schindler [mailto:[email protected]] 
Gesendet: Montag, 15. März 2010 15:48
An: Ondrej Ivanič
Cc: fw-general
Betreff: Re: [fw-general] problem with Zend_Session_SaveHandler_DbTable

Wow, interesting.  Can you file an issue for this? This looks like a 
good patch to include.

How did the null terminator get included in the object data btw?

-ralph

Ondrej Ivanič wrote:
> Hi,
> 
> 2010/3/12 Ondrej Ivanič <[email protected]>:
>> Surprisingly, the output from error_log was truncated:
>> 1071: Zend_Auth|a:1:{s:7:"storage";O:21:"xxxxxxxxxxxx_UserInfo":7:{s:28:"
> 
> Output was truncated because of NULL (0x00) character after 's:28:'
> which was cause of all my problems.
> So I patched DbTable session hadler:
> 
> Index: library/Zend/Session/SaveHandler/DbTable.php
> ===================================================================
> --- library/Zend/Session/SaveHandler/DbTable.php      (revision 18687)
> +++ library/Zend/Session/SaveHandler/DbTable.php      (working copy)
> @@ -319,7 +319,7 @@
> 
>          if (count($rows)) {
>              if ($this->_getExpirationTime($row = $rows->current()) > time()) 
> {
> -                $return = $row->{$this->_dataColumn};
> +                $return = pack("H*", $row->{$this->_dataColumn});
>              } else {
>                  $this->destroy($id);
>              }
> @@ -338,6 +338,7 @@
>      public function write($id, $data)
>      {
>          $return = false;
> +        $data = bin2hex($data);
> 
>          $data = array($this->_modifiedColumn => time(),
>                        $this->_dataColumn     => (string) $data);
> 
> 

Reply via email to