• Resolved tbo460

    (@thibotus01)


    Hi,

    I’m using this code: https://pastebin.com/M19M1wWZ

    And I get:

    Fatal error: Uncaught Error: Undefined constant “Reload” in /wp-content/plugins/code-snippets/php/snippet-ops.php(469) : eval()’d code:7 Stack trace: #0

    It works fine if I use the code directly in functions.php

    Thank you for your help,

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    In the array

    $categories = [Reload,Recharges,Wiederaufladung,eSIM];

    all of the items are unquoted. Are they supposed to be strings, or are these constants that are defined somewhere?

    Thread Starter tbo460

    (@thibotus01)

    I realized too. and in functions.php it wasn’t working either in php 8.

    So ['Reload','Recharges','Wiederaufladung','eSIM'];
    Is actually working fine.

    I’m wondering if there was a change in PHP 7.4 to PHP 8 ?
    I just tested in 7.4 it’s working, and 8 is throwing the error..

    Sorry about the trouble,

    Plugin Author Shea Bunge

    (@bungeshea)

    I wouldn’t have expected the code to work in PHP 7 either, but maybe it fails with a warning? Glad to hear that it’s sorted now, though

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal error: Undefined constant’ is closed to new replies.