Re: pecl/idn documentation
| From: | Christian Hammers | Date: | Mon, 05 Jan 2009 00:16:52 +0000 |
| Subject: | Re: pecl/idn documentation | ||
| References: | 1 2 3 4 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969379943@lists.php.net to get a copy of this message | ||
Hello
Am Sun, 4 Jan 2009 20:28:13 +0100
schrieb "Hannes Magnusson" <hannes.magnusson@gmail.com>:
> On Sun, Jan 4, 2009 at 19:53, Christian Hammers <ch@lathspell.de>
> wrote:
> > Hello
> >
> > I've incorporated all your suggestions and added a .cvsignore as
> > well as some "choice=opt" markers to the optional function
> > parameters.
> >
> > The new diffs are attached.
>
> @ in examples is a big no no.
You mean suppressing error messages is bad style? The context here was:
// Cannot convert a domain name to ASCII that contains non-ASCII chars
// but already starts with "xn--"
$ascii = @idn_to_ascii("xn--".chr(0xC3).chr(0xA4), $errorcode);
if ($ascii === false) {
printf("Detected error %d: %s\n", $errorcode,idn_strerror($errorcode));
}
The problem was that idn_to_ascii() prints E_USER_WARNING messages if
errors occur. I found not other way to check the outcome of this
function without any nasty stderr output except for temporarily
disabling error reporting and passing the optional $errorcode variable.
(I'd love to have exceptions here but the current implementation exists
since four years, just not properly documented yet)
> + <function name='idn_strerror' from='PHP 5 >= 5.2.0'/>
> This ext is in PECL, not bundled with PHP5.2.0.
OK, fixed:
diff -u en/reference/idn/versions.xml en/reference/idn/versions.xml
--- en/reference/idn/versions.xml 2008-12-05 03:34:10.000000000 +0100
+++ en/reference/idn/versions.xml 2008-12-05 03:34:10.000000000 +0100
@@ -5,9 +5,9 @@
-->
<versions>
<!-- Functions -->
- <function name='idn_strerror' from='PHP 5 >= 5.2.0'/>
- <function name='idn_to_ascii' from='PHP 5 >= 5.2.0'/>
- <function name='idn_to_utf8' from='PHP 5 >= 5.2.0'/>
+ <function name='idn_strerror' from='PECL idn >= 0.2'/>
+ <function name='idn_to_ascii' from='PECL idn >= 0.1'/>
+ <function name='idn_to_utf8' from='PECL idn >= 0.1'/>
<!-- Methods -->
</versions>
bye,
-christian-