Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

idn_to_ascii, idn_to_unicode in EmailValidator and UrlValidator #312

Closed
ShNURoK42 opened this issue May 19, 2013 · 8 comments
Closed

idn_to_ascii, idn_to_unicode in EmailValidator and UrlValidator #312

ShNURoK42 opened this issue May 19, 2013 · 8 comments
Assignees
Labels
status:ready for adoption Feel free to implement this issue. type:docs Documentation
Milestone

Comments

@ShNURoK42
Copy link
Contributor

Guys, idn_to_ascii, idn_to_unicode and idn_to_utf8 not support php 5.3 it need PECL intl >= 1.0.2, PECL idn >= 0.1 yiisoft/yii#2183
In default mode php 5.3 call this error:
Fatal error: Call to undefined function idn_to_ascii() in ...
I think it's not best solution #143

@resurtm
Copy link
Contributor

resurtm commented May 19, 2013

First of all let's discuss only about idn_to_ascii (both idn_to_unicode and idn_to_utf8 are not somehow used in the Yii2 codebase).

Second, could you please post you operating system family and version? Precise PHP version and list of the installed/activated extensions would also help.

In case you're using rpm based distro you could do that by performing following actions:

$ uname -a
$ cat /etc/redhat-release
$ rpm -qa | grep php
$ php -me

(dpkg could be used for deb based distros.)

Note that intl extension is bundled with PHP distribution out of the box: http://pecl.php.net/package/intl

This extension has been bundled with PHP since version 5.3. This PECL version backports
improvements made in the development version of PHP to PHP 5.2, 5.3 and 5.4.

I've tested idn_to_ascii with PHP 5.3.* and here's my summary:

CentOS 5.9:

$ uname -a
Linux *** 2.6.18-028stab101.1 #1 SMP Sun Jun 24 19:50:48 MSD 2012
x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/redhat-release 
CentOS release 5.9 (Final)

$ rpm -qa | grep intl
php53-intl-5.3.3-13.el5_8

$ php -me | grep intl
intl

$ php -v
PHP 5.3.3 (cli) (built: Jun 27 2012 12:25:48) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

$ php -r "echo idn_to_ascii('президент.рф').\"\\n\";"
xn--d1abbgf6aiiy.xn--p1ai

$ yum info php53-intl
Loaded plugins: allowdowngrade, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.neolabs.kz
 * epel: mirror.nus.edu.sg
 * extras: mirror.neolabs.kz
 * updates: mirror.neolabs.kz
CentALT                                                                     |  951 B     00:00     
base                                                                        | 1.1 kB     00:00     
epel                                                                        | 3.6 kB     00:00     
extras                                                                      | 2.1 kB     00:00     
updates                                                                     | 1.9 kB     00:00     
Installed Packages
Name       : php53-intl
Arch       : x86_64
Version    : 5.3.3
Release    : 13.el5_8
Size       : 163 k
Repo       : installed
Summary    : Internationalization extension for PHP applications
URL        : http://www.php.net/
License    : PHP and LGPLv2 and LGPLv2+
Description: The php-intl package contains a dynamic shared object that will add
           : support for using the ICU library to PHP.

CentOS 6.4:

$ uname -a
Linux *** 2.6.18-164.15.1.el5.028stab068.9ent #1 SMP Tue Mar 30 19:30:08 MSD 2010
i686 i686 i386 GNU/Linux

$ cat /etc/redhat-release 
CentOS release 6.4 (Final)

$ rpm -qa | grep intl
php-intl-5.3.23-1.el6.i686

$ php -me | grep intl
intl

$ php -v
PHP 5.3.23 (cli) (built: Mar 20 2013 13:46:40) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

$ php -r "echo idn_to_ascii('президент.рф').\"\\n\";"
xn--d1abbgf6aiiy.xn--p1ai

$ yum info php-intl
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink                                                               | 5.5 kB     00:00     
 * base: mirror.neolabs.kz
 * epel: ftp.jaist.ac.jp
 * extras: mirror.neolabs.kz
 * updates: mirror.neolabs.kz
CentALT                                                                     |  951 B     00:00     
CentALT/primary                                                             |  79 kB     00:00     
CentALT                                                                                    252/252
base                                                                        | 3.7 kB     00:00     
epel                                                                        | 4.2 kB     00:00     
epel/primary_db                                                             | 4.3 MB     00:03     
extras                                                                      | 3.5 kB     00:00     
updates                                                                     | 3.5 kB     00:00     
updates/primary_db                                                          | 2.4 MB     00:00     
vz-base                                                                     |  951 B     00:00     
vz-updates                                                                  |  951 B     00:00     
Installed Packages
Name        : php-intl
Arch        : i686
Version     : 5.3.23
Release     : 1.el6
Size        : 332 k
Repo        : installed
From repo   : CentALT
Summary     : Internationalization extension for PHP applications
URL         : http://www.php.net/
License     : PHP
Description : The php-intl package contains a dynamic shared object that will add
            : support for using the ICU library to PHP.

Debian Wheezy (current stable)

http://packages.debian.org/wheezy/php5-intl

I think you should check your activated PHP extensions once more.

@ShNURoK42
Copy link
Contributor Author

Yes. Need to work intl extension. By default, it's disabled

@resurtm
Copy link
Contributor

resurtm commented May 19, 2013

By default, it's disabled

MS Windows defaults? Every operating system has its own defaults and since we're russian speaking people i'm trying to always install and enable intl extension (regardless of the problems and situations) and i recommend to do same for all non-english speakers. :-) Don't think it's a big deal.

@resurtm resurtm closed this as completed May 19, 2013
@ShNURoK42
Copy link
Contributor Author

No, not only windows. In debian we need install php5-intl package. In CentOS i don't know.
This function isn't included in PHP core, therefore by default, it's disabled.

@resurtm
Copy link
Contributor

resurtm commented May 19, 2013

This function isn't included in PHP core, therefore by default, it's disabled.

It is. Check out this: http://lxr.php.net/search?q=&defs=&refs=idn_to_ascii&path=&hist=&project=PHP_5_3

@ShNURoK42
Copy link
Contributor Author

Maybe add exception warning about it?

@resurtm
Copy link
Contributor

resurtm commented May 19, 2013

Maybe add exception warning about it?

👍 agree and we have to enhance a bit documentation of the appropriate validator classes.

@resurtm
Copy link
Contributor

resurtm commented May 22, 2013

@ShNURoK42, thanks for proposal!

tonydspaniard added a commit to tonydspaniard/yii2 that referenced this issue May 22, 2013
* upstream:
  Fixes yiisoft#312. Additional docs on IDN in EmailValidator and UrlValidator.
cebe added a commit that referenced this issue May 22, 2013
* master: (179 commits)
  Fixes #312. Additional docs on IDN in EmailValidator and UrlValidator.
  bug fix.
  Added composer extension.
  Added psr-0.
  Fixed breaking test.
  Fixed iii include path.
  reorganized the main repo to satisfy PSR-0.
  Fixed bootstrap asset registration issue.
  Widget::$transition removed, bundles depency fixed
  'yii/bootstrap/popover' bundle depency optimization
  Bundle names fixes, base widget fixes, other widgets fixes
  Fixed join query for AR.
  Responsive bundle depency fix
  Bundle names and depency fixes
  YiiBase move all after class definition
  YiiBase
  Reloaded
  Additional bootstrap packages
  New approach
  minor refactoring.
  ...

Conflicts:
	tests/unit/framework/caching/ApcCacheTest.php
	tests/unit/framework/caching/CacheTest.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:ready for adoption Feel free to implement this issue. type:docs Documentation
Projects
None yet
Development

No branches or pull requests

2 participants