Skip to content

Commit

Permalink
Use idn_to_ascii function instead of idna_convert library
Browse files Browse the repository at this point in the history
The `idna_convert` library is outdated and there is now a native PHP function to convert IDNs to Punycode.
It requires `intl` extension or a [polyfill](https://github.com/symfony/polyfill-intl-idn).

`compress_parse_url` will append `?` and `#` to the URI even if there is no query string or hash fragment, and insert `//` even when there is no authority part. To avoid this and the breakage of tests this would cause, let’s call the function only for files having a non-empty authority part of the URI (i.e. non-local files) that contains characters that are not considered printable ASCII (such as bytes of UTF-8 encoded Unicode characters).

In the future, we might leave the IDN support to HTTP library to deal with.
  • Loading branch information
jtojnar committed Feb 18, 2023
1 parent 7b0901c commit be4c9b8
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 1,608 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/simplepie/simplepie/compare/1.8.0...master)

### Changed

- Use `idn_to_ascii` function instead of `idna_convert` library (requires `intl` extension or a [polyfill](https://github.com/symfony/polyfill-intl-idn)) by @jtojnar in [#785](https://github.com/simplepie/simplepie/pull/785)

### Removed

- Third-party `idna_convert` library is no longer part of the repository by @jtojnar in [#785](https://github.com/simplepie/simplepie/pull/785)

## [1.8.0](https://github.com/simplepie/simplepie/compare/1.7.0...1.8.0) - 2023-01-20

### Added
Expand Down
7 changes: 3 additions & 4 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Requirements
* PHP 7.2+ (Required since SimplePie 1.8.0)
* libxml2 (certain 2.7.x releases are too buggy for words, and will crash)
* One of iconv, mbstring or intl extensions
* Optionally, intl extension, [symfony/polyfill-intl-idn](https://github.com/symfony/polyfill-intl-idn) or cURL extension built with IDN support to support IDNs
* cURL or fsockopen()
* PCRE support

Expand All @@ -29,10 +30,8 @@ What comes in the package?
server for required settings.
6. `demo/` - A basic feed reader demo that shows off some of SimplePie's more
noticeable features.
7. `idn/` - A third-party library that SimplePie can optionally use to
understand Internationalized Domain Names (IDNs).
8. `build/` - Scripts related to generating pieces of SimplePie
9. `test/` - SimplePie's unit test suite.
7. `build/` - Scripts related to generating pieces of SimplePie
8. `test/` - SimplePie's unit test suite.

### Where's `simplepie.inc`?
Since SimplePie 1.3, we've split the classes into separate files to make it easier
Expand Down
1 change: 0 additions & 1 deletion demo/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// Include SimplePie
// Located in the parent directory
include_once('../autoloader.php');
include_once('../idn/idna_convert.class.php');

// Create a new instance of the SimplePie object
$feed = new \SimplePie\SimplePie();
Expand Down
1 change: 0 additions & 1 deletion demo/test.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
include_once('../autoloader.php');
include_once('../idn/idna_convert.class.php');

// Parse it
$feed = new \SimplePie\SimplePie();
Expand Down
502 changes: 0 additions & 502 deletions idn/LICENCE

This file was deleted.

123 changes: 0 additions & 123 deletions idn/ReadMe.txt

This file was deleted.

0 comments on commit be4c9b8

Please sign in to comment.