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

PHP 5.2 not compatible #1055

Closed
barbuslex opened this issue Jan 19, 2016 · 24 comments
Closed

PHP 5.2 not compatible #1055

barbuslex opened this issue Jan 19, 2016 · 24 comments
Assignees
Milestone

Comments

@barbuslex
Copy link

Hi,

I have this error on PHP 5.2 :

Call to undefined function array_replace_recursive() in //lib/Minz/Configuration.php

array_replace_recursive() is available on PHP 5.3. In FreshRSS documentation it is writtent compatible with PHP 5.2.1+.

Can you help me ?

++

@Alkarex
Copy link
Member

Alkarex commented Jan 19, 2016

Ok, this should be easy to fix. I will make a patch.

@barbuslex
Copy link
Author

Ok thanks !
Maybe there are other inconsistencies I did not go further in the script.

@Alkarex
Copy link
Member

Alkarex commented Jan 24, 2016

@barbuslex Here is a patch. Could you please test #1059 ?

@barbuslex
Copy link
Author

@Alkarex I've tested.

Another error now :

Fatal error: Cannot redeclare recurse() (previously declared in /lib/lib_rss.php:20) in /lib/lib_rss.php on line 20

I've tried to change recurse() by recurse_arr() (_arr for array replace recursive) and i get the same error :

Fatal error: Cannot redeclare recurse_arr() (previously declared in /lib/lib_rss.php:20) in /lib/lib_rss.php on line 20

@barbuslex
Copy link
Author

In your modification in /lib/lib_rss.php,

I have replace :

function recurse($array, $array1) {
    foreach ($array1 as $key => $value) {
        if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
            $array[$key] = array(); //create new key in $array, if it is empty or not an array
        }
        if (is_array($value)) {
            $value = recurse($array[$key], $value); // overwrite the value in the base array
        }
        $array[$key] = $value;
     }
    return $array;
}

By :

if (!function_exists('recurse')) {
    function recurse($array, $array1) {
        foreach ($array1 as $key => $value) {
            if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
                $array[$key] = array(); //create new key in $array, if it is empty or not an array
            }
            if (is_array($value)) {
                $value = recurse($array[$key], $value); // overwrite the value in the base array
            }
            $array[$key] = $value;
        }
        return $array;
    }
}

And it work's !

But now, in installation steps (url : /p/i/index.php?step=2) i have this error :

Parse error: syntax error, unexpected '{' in /lib/password_compat.php on line 10

The line in question is (/lib/password_compat.php line 10) :

namespace {

@Alkarex
Copy link
Member

Alkarex commented Jan 25, 2016

Ah, yes indeed. The password form requires PHP 5.3.3, and the inclusion of this code needs to check for cryptAvailable() first.

On line https://github.com/FreshRSS/FreshRSS/blob/dev/app/install.php#L133

if ($password_plain != false && cryptAvailable()) {

I will make a patch later.

@barbuslex
Copy link
Author

With this fix i stay on step 2 with this html alert error in top of the form :

Veuillez corriger les erreurs avant de passer à l’étape suivante.

@Alkarex
Copy link
Member

Alkarex commented Jan 25, 2016

It looks like for some reason you have been able to select form as a login method. It is a bug if this option is available for < PHP 5.3.3. Could you please try again by selecting HTTP or nothing for login?

@Alkarex
Copy link
Member

Alkarex commented Jan 25, 2016

P.S. Loging with HTTP requires that you make a password protection with your Web server, e.g. a .htaccess with Apache:

AuthUserFile /xxx/.htpasswd
AuthGroupFile /dev/null
AuthName "FreshRSS news"
AuthType Basic
Require valid-user

@Alkarex
Copy link
Member

Alkarex commented Jan 25, 2016

Indeed, there is a bug https://github.com/FreshRSS/FreshRSS/blob/dev/app/install.php#L684 which pre-selects form login even when not available. I will fix it.

Alkarex added a commit to Alkarex/FreshRSS that referenced this issue Jan 25, 2016
@Alkarex
Copy link
Member

Alkarex commented Jan 25, 2016

I have made another attempt in #1059 (not tested).
I may have to install a virtual machine with PHP 5.2 to test...

@barbuslex
Copy link
Author

I have succefully install FreshRSS with this fix.
But it's impossible to enable authentication. Non authentication mode is very dangerous :(

@Alkarex
Copy link
Member

Alkarex commented Jan 26, 2016

Yes, form-based login requires PHP 5.3.3+. With older version, you can use HTTP login. See #1055 (comment)
(This is the login system I use myself)

@barbuslex
Copy link
Author

Yes but if i want generate a rss feed aggregated must not authentication in this case.

@Alkarex
Copy link
Member

Alkarex commented Jan 26, 2016

HTTP login is less convenient for that indeed, but there are different possibilities such as making some URL rewriting for those URLs or a proxy. (I do that for my Shaarli, of which I only expose an RSS feed, the rest being with an HTTP password).

Until November 2016, you can also use Persona for login #1052

On a related topic, here is a reference to a discussion from a year ago about PHP versions #789 (comment)

Out of curiosity, on which distribution do you run PHP 5.2? (It is interesting to get some feedback from users to help setting minimal requirements).

@barbuslex
Copy link
Author

I will try persona.

I use 000webhost.com hosting ^^

@royalterra
Copy link

@barbul..... 000 is a share hosting with very bad performance one and is hack several times. Really if you use free hosting like that why you post bugs?

@Alkarex
Copy link
Member

Alkarex commented Jan 26, 2016

In any case, my plan is more or less to have one last version of FreshRSS supporting PHP 5.2, then to set the minimal version to PHP 5.3.3 for some time (for CentOS 6, which stops in Q2 2017, but we may not wait that long).

@Alkarex
Copy link
Member

Alkarex commented Jan 26, 2016

@barbuslex Maybe your hosting plan allows to change the PHP version. Did you check?

@barbuslex
Copy link
Author

Yes i know it's just for test this plan. I will migrate to better hosting plan later.
Not possible to change PHP version in free hosting :)

@royalterra
Copy link

That host not allow changes and is full of limitations and bugs for that is hack several times a year. Still I got emails from the admin every time go down. really a hosting can be free but you choice the worse free hosting in internet

@barbuslex
Copy link
Author

Yes ^^ i have migrate to GoogieHost with last version of PHP.

Alkarex added a commit to Alkarex/FreshRSS that referenced this issue Jan 26, 2016
@Alkarex
Copy link
Member

Alkarex commented Jan 26, 2016

Just to close the topic here, can you please confirm, @barbuslex , that #1059 works with your PHP 5.2?

@barbuslex
Copy link
Author

Yes it work's fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants