frostschutz / MyBB-Google-SEO

Search Engine Optimization plugin for MyBB.
https://community.mybb.com/thread-202483.html
GNU General Public License v3.0
30 stars 25 forks source link

Not compatible with PHP 7.*? #63

Open ghost opened 6 years ago

ghost commented 6 years ago

Hey, i attemped to install Google SEO but i kept getting warnings

File | Line | Function -- | -- | -- C:\xampp\htdocs\LeakZone\inc\plugins\google_seo\plugin.php | 550 | errorHandler->error C:\xampp\htdocs\LeakZone\inc\plugins\google_seo\plugin.php | 68 | google_seo_plugin_status C:\xampp\htdocs\LeakZone\inc\plugins\google_seo.php | 50 | google_seo_plugin_info C:\xampp\htdocs\LeakZone\admin\modules\config\plugins.php | 527 | google_seo_info C:\xampp\htdocs\LeakZone\admin\index.php | 821 | require

I figured that this might be because i use PHP 7.2.1 but i cannot seem to find a XAMPP version with PHP 5.1.0? ,

frostschutz commented 6 years ago

Are you using the version from GitHub? It already has two fixes regarding PHP 7.2.x compatibility. There is also a fix in github frostschutz/MyBB-PluginLibrary.

I have to do a full code review regarding 7.2.x compatibility, it seems I've been checking arrays in particular in a way PHP does not like (anymore).

ghost commented 6 years ago

Which release of PluginLibrary do i get for MyBB 1.8.15? I tried 12 and 11 and MyBB says theyre not compatible, just downloaded the newest version of Google SEO from your github.

frostschutz commented 6 years ago

The one here https://github.com/frostschutz/MyBB-PluginLibrary

ErikThiart commented 6 years ago

Hey @frostschutz

I have the same issue.

These are the error messages:

File: inc/plugins/google_seo/404.php (Line no. 37)
Message
Use of undefined constant THIS_SCRIPT - assumed 'THIS_SCRIPT' (this will throw an Error in a future version of PHP) 
File: inc/plugins/google_seo/url.php (Line no. 159)
Message
Use of undefined constant THIS_SCRIPT - assumed 'THIS_SCRIPT' (this will throw an Error in a future version of PHP)
File: inc/plugins/google_seo/url.php (Line no. 1101)
Message
Use of undefined constant THIS_SCRIPT - assumed 'THIS_SCRIPT' (this will throw an Error in a future version of PHP) 

Info on the plugin

    $info = array(
        "name"          => "Google SEO",
        "website"       => "https://github.com/frostschutz/MyBB-Google-SEO",
        "description"   => "{$lang->googleseo_plugin_description}",
        "author"        => "Andreas Klauer",
        "authorsite"    => "mailto:Andreas.Klauer@metamorpher.de",
        "version"       => "1.8.2",
        "guid"          => "8d12371391e1c95392dd567617e40f7f",
        "compatibility" => "*",
        "codename"      => "google_seo",
    );
Eldenroot commented 6 years ago

Do you have any ETA? This plugin is a must have one, but my webhosting pushes and will update to php 7.2 in 12 days :(

PennyLook commented 6 years ago

@fvlthy @Eldenroot Here's fix: you should change 550 line (in google_seo\plugin.php) to:

if($edits && count($edits) ==1)

After that I do not have any warnings.

frostschutz commented 6 years ago

@PennyLook good catch, but it can also be > 1. I added the missing variable initialization.

marble34534 commented 6 years ago

Hello,

If I use PHP 7.2, I will get the following error:

Type: 2 File: inc/plugins/google_seo/sitemap.php (Line no. 462) Message sizeof(): Parameter must be an array or an object that implements Countable

I use Google SEO (1.8.2) and MyBB 1.8.18

frostschutz commented 6 years ago

Thanks, I'll try to make a new release over the weekend. Remind me if I don't.

frostschutz commented 6 years ago

Released the update (along with an update for PluginLibrary).

Please let me know if there any more problems. Thank you.

marble34534 commented 6 years ago

Thank you very much :)