[PHP] script stopped working- no output from unserialize()

2006-08-09 Thread Ross
So,

When I echo out the results from the db I get the serialized data but when I 
try and pass the serialized data to the function to unserialize the output 
it doesn't work - no output what-so-ever. Also when the serialized data is 
sent to the function and then echoed out before it is unserialized() I get 
the expected result .- eg 
a:4:{i:0;s:4:pass;i:1;s:4:pass;i:2;s:4:pass;

Which leads me to believe that the problem is with the php function 
unserialize().

The same function works fine locally. I am working with php version 5 
locally and version 4.4.2 on the remote host Could that be the problem?


R.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script stopped working- no output from unserialize()

2006-08-09 Thread Jochem Maas
Ross wrote:
 So,
 
 When I echo out the results from the db I get the serialized data but when I 
 try and pass the serialized data to the function to unserialize the output 
 it doesn't work - no output what-so-ever. Also when the serialized data is 
 sent to the function and then echoed out before it is unserialized() I get 
 the expected result .- eg 
 a:4:{i:0;s:4:pass;i:1;s:4:pass;i:2;s:4:pass;

php -r 'echo serialize(array(pass,pass,pass));'
a:4:{i:0;s:4:pass;i:1;s:4:pass;i:2;s:4:pass;}

php -r 
'var_dump(unserialize(a:4:{i:0;s:4:\pass\;i:1;s:4:\pass\;i:2;s:4:\pass\;));'
false

what does your serialized value NOT have that mine does?

 
 Which leads me to believe that the problem is with the php function 
 unserialize().

looks to me like you are giving unserialize() a borked string and it's giving
you boolean false in return - that's a fair swap in my book.

 
 The same function works fine locally. I am working with php version 5 
 locally and version 4.4.2 on the remote host Could that be the problem?

you can rule it out until you can rule it out.

 
 
 R.
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script stopped working- no output from unserialize()

2006-08-09 Thread Robert Cummings
On Wed, 2006-08-09 at 21:06 +0100, Ross wrote:
 So,
 
 When I echo out the results from the db I get the serialized data but when I 
 try and pass the serialized data to the function to unserialize the output 
 it doesn't work - no output what-so-ever. Also when the serialized data is 
 sent to the function and then echoed out before it is unserialized() I get 
 the expected result .- eg 
 a:4:{i:0;s:4:pass;i:1;s:4:pass;i:2;s:4:pass;
 
 Which leads me to believe that the problem is with the php function 
 unserialize().
 
 The same function works fine locally. I am working with php version 5 
 locally and version 4.4.2 on the remote host Could that be the problem?

There are incompatibilities between 4 and 5 with respect to unserialize,
though I thought it was forward incompatibility and not backward. For
instance PHP didn't mind unserializing integer keys that were denoted as
strings, whereas PHP 5 would choke unless the key was serialized
specifically as an integer when all it contained was integer digits. I
don't know what your exact problem is, but it could be an
incompatibility issue. Also PHP5 may have added extra datatypes or
magic to the serialization process that PHP4 may not recognize. Maybe
turn your error logging to max to see if you get an error message
indicating corruption.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] script stopped working- no output from unserialize()

2006-08-09 Thread Richard Lynch
On Wed, August 9, 2006 3:06 pm, Ross wrote:
 When I echo out the results from the db I get the serialized data but
 when I
 try and pass the serialized data to the function to unserialize the
 output
 it doesn't work - no output what-so-ever. Also when the serialized
 data is
 sent to the function and then echoed out before it is unserialized() I
 get
 the expected result .- eg
 a:4:{i:0;s:4:pass;i:1;s:4:pass;i:2;s:4:pass;

This seems to be missing a closing } on the end, from this naive
reader's crude guess at what should be there...

Are you sure the DB text field length is big enough...?

 Which leads me to believe that the problem is with the php function
 unserialize().

 The same function works fine locally. I am working with php version 5
 locally and version 4.4.2 on the remote host Could that be the
 problem?

It's entirely possible that the serialize/unserialize functions
changed the internal data format from 4 to 5, I presume...

Compare the output from 4.4.2 of ?php echo serialize($foo);? and the
same $foo on PHP 5.0 and then see if they are the same.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php