Support » Plugin: WooCommerce UPC, EAN, and ISBN » This works – with a fatal flaw. And here’s the fix

  • Resolved dazemx

    (@dazemx)


    This plugin works fine with Apache, but seemingly not with Ngnix. It resulted in the entire live site going down with an Error 500 as soon as I enabled the plugin.

    The fix is relatively easy, took me about 3 minutes total. I hope the developer updates the plugin to reflect my findings.

    The error is
    PHP Fatal error: Can't use function return value in write context.. in class-woo-gtin-admin.php on line 75

    Line 75 of that file looks like this
    $label = ( !empty( get_option( 'hwp_gtin_text' ) ) ? get_option( 'hwp_gtin_text' ) : 'GTIN' );

    Its a simple fix, replacing the line above to the below worked

    $hwp_gtin_text = get_option( 'hwp_gtin_text' );
    $label = ( !empty( $hwp_gtin_text ) ? $hwp_gtin_text : 'GTIN' );

    And also finding any other parts of the plugin which is attempting to set a variable from the value of a get_option() result.

    You cannot (should not) use get_option inside an if() statement. Its as simple as that.

    Please update the plugin! For now, on the site I was working on, I have had to change the Plugin Title to *DO NOT UPDATE* until I have a confirmed fix from the developer!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Scott Bolinger

    (@scottopolis)

    Hi, thanks for the error report. This is not an ngnix bug, it’s because you are using PHP 5.4 or earlier. I can fix the issue for old versions of PHP, but you really should update to PHP 5.5 or later.

    PHP 5.4 reached end of life in 2015, I’d recommend updating to PHP 7.

    Plugin Author Scott Bolinger

    (@scottopolis)

    Fix for < PHP 5.4 will be released in the next update.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘This works – with a fatal flaw. And here’s the fix’ is closed to new replies.