• Resolved JochenT

    (@jochent)


    Hi!

    Thank you for this very usefull plugin.

    Unfortunately our error log is cluttered with a PHP Notice which informs about the use of a none existent index in an array access.

    [21-Apr-2026 11:39:25 UTC] PHP Notice: Undefined index: user_id_26 in /usr/www/xxxxxx/wp-content/plugins/custom-post-type-ui/inc/utility.php on line 1163

    The code around this line is

    1159 if ( $screen->base === 'edit' && ! empty( $_GET['post_type'] ) && in_array( $_GET['post_type'], $public, true ) ) {
    1160 $dismissals = get_option( 'cptui-user-dismissed-extended-upsell', [] );
    1161 if ( ! empty( $dismissals ) ) {
    1162 $user_id = get_current_user_id();
    1163 if ( 'true' === $dismissals[ 'user_id_' . $user_id ] ) {
    1164 return;
    1165 }
    1166 }
    // ...
    1172 }

    The option value for option cptui-user-dismissed-extended-upsell is

    a:1:{s:9:"user_id_8";s:4:"true";}

    The user with id 26 is not part of the option array. Thus a PHP Notice is triggered when trying to access this none existing array element. A previous check for existence of the element is needed.

    I would appreciate it if this can be solved with the next update.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘PHP Notice: Undefined index’ is closed to new replies.