Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
fix(IDN): use INTL_IDNA_VARIANT_UTS46 for idn_* functions (#20)
Browse files Browse the repository at this point in the history
* fix(IDN): use INTL_IDNA_VARIANT_UTS46 for idn_* functions

* fix(IDN): use INTL_IDNA_VARIANT_UTS46 for idn_* functions
  • Loading branch information
layershifter authored Nov 18, 2017
1 parent c27974a commit e570f7a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ env:
- ENGINE=php VERSION=7.0 INTL=1
- ENGINE=php VERSION=7.1 INTL=0
- ENGINE=php VERSION=7.1 INTL=1
- ENGINE=php VERSION=7.2 INTL=0
- ENGINE=php VERSION=7.2 INTL=1
- ENGINE=hhvm INTL=0

before_script:
Expand Down
8 changes: 8 additions & 0 deletions src/IDN.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function toASCII($domain)
return $this->transformer->encode($domain);
}

if (defined('INTL_IDNA_VARIANT_UTS46')) {
return idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46);
}

return idn_to_ascii($domain);
}

Expand All @@ -54,6 +58,10 @@ public function toUTF8($domain)
return $this->transformer->decode($domain);
}

if (defined('INTL_IDNA_VARIANT_UTS46')) {
return idn_to_utf8($domain, 0, INTL_IDNA_VARIANT_UTS46);
}

return idn_to_utf8($domain);
}
}
7 changes: 7 additions & 0 deletions travis/docker/php-7.2-intl/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM php:7.2-rc

RUN apt-get update && apt-get install -y git zlib1g-dev libicu-dev g++
RUN docker-php-ext-install intl
RUN docker-php-ext-install zip

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
6 changes: 6 additions & 0 deletions travis/docker/php-7.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM php:7.2-rc

RUN apt-get update && apt-get install -y git zlib1g-dev
RUN docker-php-ext-install zip

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer

0 comments on commit e570f7a

Please sign in to comment.