Re: [php6] accepting an ascii string only

From: Date: Mon, 15 May 2006 21:30:41 +0000
Subject: Re: [php6] accepting an ascii string only
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-23422@lists.php.net to get a copy of this message
Looking only to the tidy extension: tidy_parse_string tidy_parse_file tidy_repair_string tidy_repair_file tidy_getopt tidy::__constructor tidy::parseFile tidy::parseString I would say that others extensions will need too. Think in charset names, options names, options values, etc.. Nuno
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 (#23422) next »