wpengine / phpcompat

WordPress Plugin: PHP Compatibility Checker

Home Page:https://wordpress.org/plugins/php-compatibility-checker/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

False Positive: ThemeGrill Importer

brendanlopez3 opened this issue · comments

This is a false positive. Note that the code accounts for the version of PHP in use.

FILE: REDACTED/wp-content/plugins/themegrill-demo-importer/includes/importers/wordpress-importer/class-wxr-importer.php

FOUND 1 ERROR AFFECTING 1 LINE

958 | ERROR | Indirect access to variables, properties and methods will be evaluated strictly in left-to-right order since PHP 7.0. Use curly braces to remove ambiguity.

            foreach ( $item['postmeta'] as $meta ) {
                    if ( version_compare( PHP_VERSION, '7.0.0' ) >= 0 ) {
                            ${$meta['key']} = $meta['value'];
                    } else {
                            $$meta['key'] = $meta['value'];
                    }
            }

It's not a false positive and that code is a bit silly. The "PHP 7+" version of the code will work in both PHP 5, as well as PHP 7, so for the love of code, what is that if/else doing there other than slowing down processing ?

I will refer this to themegrill, the author of the plugin. Thank you for your assistance.