• Resolved gerbull001

    (@gerbull001)


    Hi there, I get a white screen when editing a CPT where I use this icon ACF field, settings using FA5. The issue, it seems, is here in /fields/acf-font-awesome-v5.php

    // Original problematic code
    $prefix = substr( $select_value, 0, 3 );

    // Modified code with checks to ensure $select_value is a string
    if (is_array($select_value)) {
    error_log("Expected string, got array. Variable contents: " . print_r($select_value, true));
    $select_value = ''; // Set to empty string or handle appropriately
    }

    $prefix = substr( $select_value, 0, 3 ); // This is the line where we ensure $select_value is a string

    I thought I would share in case anyone else has the issue

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    Hey @gerbull001,

    Sorry for the late reply this one slipped under my radar. If you still have an environment that could reproduce this issue, are you able to log the value of $select_value and report back?

    There are many ways to do that and you can feel free to use whatever you are comfortable with. I often do something like this for a quick log of something:

    file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/log_select_value.txt', print_r($select_value, true), FILE_APPEND);

    This would put a log_select_value.txt file in the root of your site structure with the value in it. Don’t forget to remove the log file when you are done!

    Plugin Author Matt Keys

    (@mattkeys)

    I’ve added some extra sanity checking here. I still haven’t been able to reproduce this exact issue and I’m curious what the value of $select_value was in your case. But I did see some potentially quirky behavior if someone had downgraded to FontAwesome 5.x icons after savings some 6.x icons. Although in those cases I’d expect to see some JSON in the $select_value, not an array.

    But either way, I check for arrays or json objects in this area now to avoid issues. Thanks for reporting.

    Matt

    Thread Starter gerbull001

    (@gerbull001)

    Hi, I can’t recreate the issue with the recent update. Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.