bozdoz / wp-plugin-leaflet-map

Add leaflet maps to Wordpress with shortcodes
https://wordpress.org/plugins/leaflet-map/
GNU General Public License v2.0
141 stars 72 forks source link

Fixed error in php7 #41

Closed unsanded closed 6 years ago

unsanded commented 6 years ago

Hi i did a server update, and it took my whole website offline. It was because suddenly this error was considered a fatal error. (not sure what it was before).

error: PHP Fatal error: Declaration of Leaflet_Image_Shortcode::getHTML($atts, $content) must be compatible with Leaflet_Map_Shortcode::getHTML($atts, $content = NULL) in /usr/share/webapps/wordpress/wp-content/plugins/leaflet-map/shortcodes/class.image-shortcode.php on line 16

bozdoz commented 6 years ago

Good catch! Thanks! I think I'll go in and make sure all of those methods are content=null since they could be.

bozdoz commented 6 years ago

Curious, which version of PHP were you using @unsanded ? I haven't been able to recreate this issue.

unsanded commented 6 years ago

Well this one:

$php --version
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/modules/imagick.so (libMagickWand-6.Q16HDRI.so.3: cannot open shared object file: No such file or directory), /usr/lib/php/modules/imagick.so.so (/usr/lib/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib/php/modules/imagick.so (libMagickWand-6.Q16HDRI.so.3: cannot open shared object file: No such file or directory), /usr/lib/php/modules/imagick.so.so (/usr/lib/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.0 (cli) (built: Dec  5 2017 18:56:10) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies

So it turns out that the upgrade broke more than only this. Apparently the config syntax changed. So it could be related to this. I'll have a look.

bozdoz commented 6 years ago

I ran into a bunch of such issues recently, doing an upgrade on a server running WordPress. I'll check again on 7.2! Thanks!

bozdoz commented 6 years ago

Yep, got the same errors. I'll see if I can do a cleanup and make sure these methods are using the same arguments.

unsanded commented 6 years ago

Allright, thanks for keeping up to date