Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:23419 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41494 invoked by uid 1010); 15 May 2006 21:20:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 41479 invoked from network); 15 May 2006 21:20:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 May 2006 21:20:10 -0000 X-PHP-List-Original-Sender: andrei@gravitonic.com X-Host-Fingerprint: 204.11.219.139 lerdorf.com Linux 2.5 (sometimes 2.4) (4) Received: from ([204.11.219.139:39363] helo=lerdorf.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id AD/33-19568-A80F8644 for ; Mon, 15 May 2006 17:20:10 -0400 Received: from [66.228.175.145] (borndress-lm.corp.yahoo.com [66.228.175.145]) (authenticated bits=0) by lerdorf.com (8.13.6/8.13.6/Debian-1) with ESMTP id k4FLK66a012715; Mon, 15 May 2006 14:20:06 -0700 In-Reply-To: <000901c67857$c20fa190$0100a8c0@pc07653> References: <003d01c672ef$6cde8370$0100a8c0@pc07653> <517361123ef66114064e2866c95e3caa@gravitonic.com> <000901c67857$c20fa190$0100a8c0@pc07653> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-ID: <7abd987289270ef00178d1bbf8e32c0b@gravitonic.com> Content-Transfer-Encoding: 7bit Cc: "Derick Rethans" , "PHPdev" Date: Mon, 15 May 2006 14:19:46 -0700 To: "Nuno Lopes" X-Mailer: Apple Mail (2.623) Subject: Re: [PHP-DEV] [php6] accepting an ascii string only From: andrei@gravitonic.com (Andrei Zmievski) That assumes there are a hundred places where you want to receive an ASCII string. Are they really that prevalent? -Andrei On May 15, 2006, at 12:42 PM, Nuno Lopes wrote: > Sorry for the delay. > But I think that a new type specifier could be introduced. If not you > are saying to extensions writers to duplicate the code below a hundred > times: > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "t", &name, > &name_len, &name_type) == FAILURE) { > return; > } > > if (name_type == IS_UNICODE) { > buf = zend_unicode_to_ascii(name, name_len TSRMLS_CC); > if (buf == NULL) { > php_error(E_WARNING, "my_var has to consist only of ASCII > characters"); > RETURN_FALSE; > } > } else { > buf = (char *) name; > } > > > With a new specifier you would be sure that the string you received > was ASCII-only and wouldn't have to care with conversions and such.