Re: [php6] accepting an ascii string only

From: Date: Mon, 15 May 2006 21:19:46 +0000
Subject: Re: [php6] accepting an ascii string only
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-23419@lists.php.net to get a copy of this message
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.


« previous php.internals (#23419) next »