php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60647 Encoding for first parameter for idn_to_ascii is depnding on idn-setting
Submitted: 2012-01-03 21:14 UTC Modified: 2017-04-01 20:33 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: simonsimcity at gmail dot com Assigned:
Status: Wont fix Package: idn (PECL)
PHP Version: 5.3.8 OS: Linux Debian Lenny
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
50 - 38 = ?
Subscribe to this entry?

 
 [2012-01-03 21:14 UTC] simonsimcity at gmail dot com
Description:
------------
Currently the documentation for the function idn_to_ascii describes the first parameter as following:
>> Domain to convert. In PHP 5 must be UTF-8 encoded.

The truth is that this value do not have to be encoded in UTF-8. The encoding of this string depends on the setting of idn.default_charset

This setting by default is set to ISO-8891-1 and therefore a string containing a utf8-encoded character that's invalid in ISO-8891-1 will cause the parser to crash (ending up in an "segmentation fault" message).

Try the test-script once with the ini-value idn.default_charset of "ISO-8891-1" and once of "utf-8". Using the default-value (iso-8891-1) the script will break and using "utf-8" instead it will work as expected.

Test script:
---------------
<?php
var_dump( idn_to_ascii('ә') );

echo "123";

Expected result:
----------------
PHP Notice:  IDN_IDNA_TO_ASCII: Could not convert from IDNA to ASCII in /var/www/index.php on line 1

123

Actual result:
--------------
PHP Notice:  IDN_IDNA_TO_ASCII: Could not convert from IDNA to ASCII in /var/www/index.php on line 1

Segmentation fault

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-03 21:20 UTC] simonsimcity at gmail dot com
-Operating System: Linux Debian +Operating System: Linux Debian Lenny
 [2012-01-03 21:20 UTC] simonsimcity at gmail dot com
Sorry .. I forgot to add the LibIDN-Version: 1.18
 [2012-01-03 21:27 UTC] simonsimcity at gmail dot com
Please change the "ISO-8891-1" strings to "ISO_8859-1" :) This is correct for Latin-1.
 [2012-01-05 19:48 UTC] cataphract@php.net
You're using PECL idn? Which version? I assume you're not using the intl extension, because it has no such ini setting.
 [2012-01-05 19:48 UTC] cataphract@php.net
-Type: Documentation Problem +Type: Bug -Package: Documentation problem +Package: idn
 [2012-01-06 07:59 UTC] simonsimcity at gmail dot com
The only thing I can tell you, in addition to what you know, is the RCS Version 
shown in the phpinfo() output and that I installed this extension using following 
command on my Linux-Debian machine:

aptitude install php5-idn

RCS Version: $Id: idn.c,v 0.34 2006-11-24 09:34:47 turbo Exp $
 [2013-06-07 06:50 UTC] boyan at peychev dot net
Same by me Debian 6 (squeeze)

# php -v
PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar  4 2013 13:11:17) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

Any good news about this problem?
 [2017-04-01 20:33 UTC] tpunt@php.net
-Status: Open +Status: Wont fix
 [2017-04-01 20:33 UTC] tpunt@php.net
Due to this extension not seeing any activity since 2009, this issue will not be fixed. We are therefore closing this now.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Jul 12 19:01:25 2020 UTC