Support » Plugin: IP Geo Block » Plans for PHP 7 compatiblity?

  • Resolved FireMyst

    (@firemyst)


    We were upgrading our WordPress sites to run on PHP 7.

    Doing a scan, IPGeo Block has a few issues, and was wondering when they are going to be addressed so the plugin is fully compatible with PHP 7?

    We used the plugin “PHP Compatibility Checker” and here’s the list of PHP 7 compatibility issues:

    FILE: /wp-content/plugins/ip-geo-block/classes/class-ip-geo-block-logs.php
    ————————————————————————————————————————————–
    FOUND 2 ERRORS AFFECTING 2 LINES
    ————————————————————————————————————————————–
    344 | ERROR | Global variable ‘$HTTP_RAW_POST_DATA’ is deprecated since PHP 5.6 and removed since PHP 7.0 – use php://input instead.
    348 | ERROR | Global variable ‘$HTTP_RAW_POST_DATA’ is deprecated since PHP 5.6 and removed since PHP 7.0 – use php://input instead.
    ————————————————————————————————————————————–

    FILE: /wp-content/plugins/ip-geo-block/ip-geo-api/ip2location/IP2Location.php
    —————————————————————————————————————————————————-
    FOUND 1 ERROR AFFECTING 1 LINE
    —————————————————————————————————————————————————-
    443 | ERROR | The behaviour of hexadecimal numeric strings was inconsistent prior to PHP 7 and support has been removed in PHP 7. Found: ‘0x10000’
    —————————————————————————————————————————————————-

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi @firemyst,

    Thank you so mush for your info about PHP 7.

    1. About $HTTP_RAW_POST_DATA
    I usually test my plugin with PHP 5.6.10 (sometimes, PHP 5.2.17 :)) on MAMP Pro and notice about this warning. But in xmlrpc.php of WP core, $HTTP_RAW_POST_DATA is assigned as a global value using php://input. So I think it doesn’t matter with PHP 7. How do you think?

    2. About hexadecimal numeric strings
    I didn’t know about this error until now. Then I should use

    filter_var('0x10000', FILTER_VALIDATE_INT, FILTER_FLAG_ALLOW_HEX);

    instead of 0x10000. Do you think it’s alright?

    c.f. http://php.net/manual/en/filter.filters.validate.php

    • This reply was modified 3 years, 2 months ago by tokkonopapa.
    • This reply was modified 3 years, 2 months ago by tokkonopapa.

    Thanks for your response. And I have to say I absolutely LOOOOOOOOOOOOOOOOOOOOOOOVE your plugin. 🙂

    As for those issues, I’m not a PHP Developer, so I don’t know if what you suggested will work, or is appropriate, or is even really an issue. That’s just feedback from another PHP plugin.

    I just wanted to bring it to your attention given that PHP 5.6 is coming to end-of-life and sooner (hopefully) or later everything is going to have to migrate towards 7. We’re being a bit more cautious and not moving our Production WordPress sites until most plugins pass php7 compatibility tests.

    Hopefully another developer within these forums will be able to answer your questions?

    Plugin Author tokkonopapa

    (@tokkonopapa)

    Wow, thanks for your commenting!

    OK, I just started to make my plugin compatible with PHP 7 and I keep this thread open until I finish it.

    Thank you for the heads up.

    FYI:

    I just updated to IP Geo Block version 2.2.9 (love the “must use” timing feature!), reran the PHP 7 compatibility checker, and it comes back with the following:

    FILE: /wp-content/plugins/ip-geo-block/classes/class-ip-geo-block-logs.php
    --------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------
     344 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0 - use php://input instead.
     348 | ERROR | Global variable '$HTTP_RAW_POST_DATA' is deprecated since PHP 5.6 and removed since PHP 7.0 - use php://input instead.
    --------------------------------
    
    FILE: /wp-content/plugins/ip-geo-block/wp-content/ip-geo-api/ip2location/bcmath.php
    -------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    -------------------
     156 | ERROR | Using 'break' outside of a loop or switch structure is invalid and will throw a fatal error since PHP 7.0
     157 | ERROR | Using 'break' outside of a loop or switch structure is invalid and will throw a fatal error since PHP 7.0
    -------------------
    Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi FireMyst,

    Thank you for your reporting again. I think both will not be a problem. Please refer to the discussion at #11 on Github. I’ve tested this release with PHP7 on my local environment. But I’ll improve the 2nd one in the future.

    Thanks again!

    Plugin Author tokkonopapa

    (@tokkonopapa)

    Although it was not actually error, but improved some code to restrain this issue in 2.2.9.1.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Plans for PHP 7 compatiblity?’ is closed to new replies.