Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dmytro Holovnia

    (@dholovnia)

    Hi Mike,

    This is easy to solve – please turn off notice errors. They are dummy and not providing useful information.

    error_reporting(E_ALL & ~E_NOTICE);

    Regards,
    Dima

    Thread Starter mikebronner

    (@mikebronner)

    Hi Dima,

    First, thanks for the response. Also, thanks for developing the plugin using templates, you have no idea how many plugin developers don’t do that! ??

    I have to be honest, hiding warnings is not a solution, just a work-around. I can fix the problems in the templates, but no those in the widget.php file. Can I submit a PR to handles these properly?

    I think what needs to be done is the following:

    // here we get max products to know if current page is not too big
            if ( $wp_rewrite->using_permalinks() and preg_match( "~/page/([0-9]+)~", $_POST['location'], $mathces ) or preg_match( "~paged?=([0-9]+)~", $_POST['location'], $mathces ) ) {
                $args['paged'] = min( $mathces[1], $wp_query->max_num_pages );
                $wp_query = new WP_Query( $args );
            }

    should be changed to:

    if ($wp_rewrite->using_permalinks()
                && array_key_exists('location', $_POST)
                && (preg_match( "~/page/([0-9]+)~", $_POST['location'], $mathces )
                    || preg_match( "~paged?=([0-9]+)~", $_POST['location'], $mathces ))
            ) {
                $args['paged'] = min( $mathces[1], $wp_query->max_num_pages );
                $wp_query = new WP_Query( $args );
            }

    Plugin Author Dmytro Holovnia

    (@dholovnia)

    Mike,

    hiding warnings is not a solution while hiding notices is good enough if you know what you are doing. It is dummy error to show developer that he probably miss something or maybe did it wrong. But it is only probably and maybe.

    I’ll hide notices in the code with @ on next release. array_key_exists('location', $_POST) is not an option. Speed does matter.

    Regards,
    Dima

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