PHP 7 support #443

Open
JanPetterMG opened this Issue Apr 26, 2016 · 6 comments

Projects

None yet

5 participants

@JanPetterMG
Contributor

Is PHP 7 support realistic?
http://php.net/supported-versions.php

There is currently 4 errors, 3 of them most likely due to the same port-number bug...
https://travis-ci.org/simplepie/simplepie


The coding standards used are way outdated, and with files counting 3.000+ lines, isn't making the job of fixing it easier either. Normally I'm trying to contribute instead of posting issues, but that's not realistic in this case... sorry!

2.0: Start the refactoring process, update the standards, replace old bunks of code with external maintained repositories, less code, fewer bugs, better support. Then it would be easier for everyone, also it will making sure this repository doesn't get out of date! Because who are using php 5.3 today??

@shaildyp

PHP7 works for me but the the encoding parser keeps failing. I have both mbstring & iconv available.

PHP Notice: The data could not be converted to UTF-8. You MUST have either the iconv or mbstring extension installed. Upgrading to PHP 5.x (which includes iconv) is highly recommended.

@idealley

it also works for me with php 7 on vagrant/homestead

@thinkingmedia

I'm going to be running it on 7. If I see anything that needs fixing. I'll make a PR for it.

@JanPetterMG
Contributor

Is backwards compatibility required at all cost? (there was an unspecified comment about this before 1.4 was released).
Is a 2.0-dev branch possible?

3 of the issues are probably due to bugs in the SimplePie_IRI class. 1262 lines (1182 sloc) 28.1 KB

I might rewrite it, but then it has to be from scratch !!! The current class is very complex, are using outdated standards, and could be simplified a lot.

For example, the replace_invalid_with_pct_encoding() function with it's 275 lines, can be replaced with just 2 lines, still doing the exact same job... Solution: preg_replace + array + rawurlencode

@mblaney
Member
mblaney commented May 28, 2016

I think keeping backwards compatibility was suggested because SimplePie is included in Wordpress. It should be kept unless there's a really good reason not too, if that ever happens I would be open to a 2.0-dev branch, maintained in parallel.

@JanPetterMG
Contributor

@shaildyp I also get that error, but on PHP 5.6.20, even if I have UConverter, iconv and mbstring installed, so it can't be PHP 7 specific...

If I'll set the encoding to UTF-8 in cases where the HTTP header isn't specifying any encoding (as fallback), the error shows up rather frequently.
If I'll skip set_input_encoding in such cases, the error disappears, and the feed is parsed successfully.

set_input_encoding documentation:

The character encoding to use instead of allowing SimplePie to auto-detect it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment