Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:29564 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66742 invoked by uid 1010); 19 May 2007 15:49:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 66727 invoked from network); 19 May 2007 15:49:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 May 2007 15:49:29 -0000 Authentication-Results: pb1.pair.com header.from=tokul@users.sourceforge.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=tokul@users.sourceforge.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain users.sourceforge.net from 213.197.162.99 cause and error) X-PHP-List-Original-Sender: tokul@users.sourceforge.net X-Host-Fingerprint: 213.197.162.99 avilys.eik.lt Linux 2.6 Received: from [213.197.162.99] ([213.197.162.99:37807] helo=avilys.eik.lt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/65-00717-68C1F464 for ; Sat, 19 May 2007 11:49:28 -0400 Received: from avilys.eik.lt (avilys.local [127.0.0.1]) by avilys.eik.lt (Postfix) with ESMTP id 7E90B1F5148; Sat, 19 May 2007 18:48:07 +0300 (EEST) Received: from avilys.eik.lt (avilys.local [127.0.0.1]) by avilys.eik.lt (Postfix) with ESMTP id 67DA51F5147; Sat, 19 May 2007 18:48:07 +0300 (EEST) Received: from 88.118.163.159 (NaSMail authenticated user tomas@topolis.lt) by avilys.eik.lt with HTTP; Sat, 19 May 2007 18:48:07 +0300 (EEST) Message-ID: <35054.88.118.163.159.1179589687.squirrel@avilys.eik.lt> In-Reply-To: <464F090A.9090200@zend.com> References: <51491.88.118.163.159.1179577357.squirrel@avilys.eik.lt> <464EEF4B.1030002@zend.com> <40865.88.118.163.159.1179583186.squirrel@avilys.eik.lt> <464F090A.9090200@zend.com> Date: Sat, 19 May 2007 18:48:07 +0300 (EEST) To: "Antony Dovgal" Cc: internals@lists.php.net User-Agent: NaSMail/1.0 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [PHP-DEV] PHP Unicode extension in PHP6 From: tokul@users.sourceforge.net ("Tomas Kuliavas") >> SquirrelMail scripts are designed to work with binary strings. They will >> have to deal with emails written in many different character sets. In >> some >> cases scripts must know string length in bytes and not in symbols. If >> PHP >> starts converting email body or message parts, strings won't match >> information stored in email headers. > > Try this, you'll see it's really easy: > //in Unicode mode all strings created this way are Unicode strings > $s = ""; > var_dump(strlen(($s))); > var_dump(strlen((binary)$s)); > ?> http://www.php.net/language.types.type-juggling#language.types.typecasting No (binary). PHP 4.1.2 = parse error in test2.php on line 5. PHP 5.2.0 = Parse error: syntax error, unexpected T_VARIABLE in test2.php on line 5 It is E_PARSE error, so I can't apply fix after detecting PHP6. Fix is not portable. We are talking about SquirrelMail code. Minimal PHP 4.1.x requirement. Good fix is closer to "; var_dump(strlen($s)); // add php6 test here { settype($s,'binary'); // } var_dump(strlen($s)); ?> I will have to write wrappers for all affected functions. Not wise. strlen("\xC4\x85") = 2. strlen((binary)"\xC4\x85") = 4. Not good. It is one character in utf-8. Nevermind. Will watch how PHP6-dev changes and wait for better documentation. -- Tomas