You are here: Re: question mark in serialized object « PHP Programming Language « IT news, forums, messages
Re: question mark in serialized object

Posted by ZeldorBlat on 08/20/07 18:40

On Aug 20, 2:13 pm, "guile...@hotmail.com" <guile...@hotmail.com>
wrote:
> When serializing the following object:
> class a {
> private $_x = 0;
>
> }
>
> I get
> O:1:"a":1:{s:5:"a?_x";i:0;}
>
> The question mark character in that string, which I belive has
> something to do with
> indicating the private visibility, is not actually a question mark,
> but some other
> symbol. If you copy and paste that character in vi, it comes out as 3
> different
> chars (an i with 2 dots, upside down question mark and 1/2 symbol) or
> in
> a ascii-hex converter it comes out as %fffd as opposed to the actual
> question
> mark character (?) of %3f
>
> What exactly is this character(s)?
>
> The reason I'm having trouble is I'm trying to serialize an object and
> store it in
> MSSQL, but MSSQL throws an error about unclosed quote.
>
> I figure if I could change these chars into something, store it and
> change it back
> later I would be okay, but I can't figure out what it is (they are) to
> search for it.
>
> Any help or insight would be appreciated.

According to this script it's a null character:

<?php

class a {
private $_x = 0;
}

$a = new a();
$str = serialize($a);

for($i = 0; $i < strlen($str); $i++)
echo $str[$i] . "\t" . ord($str[$i]) . "\n"
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация