Re: serialize() and special ANSI characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



# ylacan@xxxxxxxxxx / 2007-02-19 15:56:15 +0100:
> I'm just curious to find out if I'm the only person to have bumped into 
> this kind of issue with serialize/unserialize.
> 
> When I try and serialize an array containing a string value with the "?" 
> character (alt+241 ASCII) such as :
> 	"120GB 2X512MB 15.4IN DVD?RW VHP  FR"
> 
> The resulting serialized array is truncated.
> ie. I would obtain :
> 			 
> "a:17:{i:0;s:1:"A";i:1;s:7:"TOSHIBA";i:2;s:4:"3740";i:3;s:7:"404D862";i:4;s:31:"SATELLITE 
> A100-044 CD/T2060-1.6";i:5;s:35:"120GB 2X512MB 15.4IN DVD"
> 
> As you can see serialization seems to stall as soon as the "?" character 
> shows up.

I don't see the effect you're mentioning, but this is on FreeBSD, so
perhaps there's a problem on Windows.  I don't really believe it,
though, and would hazard a guess you're running into display problems
with your browser.

Another thing to mention is that ASCII only goes up to 127.  You may
desire for ASCII 241 to mean +/-, but n-tilde is also a popular
interpretation... Use a character set which actually includes +/- as a
single character, and an encoding that can handle that charset.

The following test fails in 5.2.1:

<?php

class serializeASCII241 extends Tence_TestCase
{
    function testTruncates()
    {
        return $this->assertEquals(
            "120GB 2X512MB 15.4IN DVD",
            serialize("120GB 2X512MB 15.4IN DVD" . chr(241) . "RW VHP  FR")
        );
    }
}

?>

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux