Support » Plugin: Responsive Select Menu » Error Warning: sprintf() [function.sprintf]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author sevenspark

    (@sevenspark)

    RSM doesn’t call that function, so I’m not sure how it might be causing that warning. Are you using the latest version of WordPress?

    If this is a production site, I’d recommend setting WP_DEBUG to false to stop the warning from being printed.

    Thread Starter felixlvh

    (@felixlvh)

    Hi it’s using latest version of wordpress and wp_debug is already set to false 🙁

    Im using woothemes canvas theme along with ubermenu and this Responsive Select Menu and i am getting the same error:
    Warning: sprintf() [function.sprintf]: Too few arguments in /nfs/c01/h14/mnt/32365/domains/www.com/wp-includes/nav-menu-template.php on line 406

    RSM doesn’t call that function, so I’m not sure how it might be causing that warning. Are you using the latest version of WordPress?

    If this is a production site, I’d recommend setting WP_DEBUG to false to stop the warning from being printed.

    Hi sevenspark! I’m try to explain. So, I meet this problem, when i change permalinks setting (/wp-admin/options-permalink.php) from “Default” to “Post name”. I’m from Russia, so, here peoples are using cyrillic alphabet and after i’m change that setting, wordpress will replace page id to alias.
    For example, on “news” word. On russian “news” word written as “Новости” I think now you see instead of the word, a kind of abracadabra, but it’s okay) and if that word used as alias for some page, than WordPress encode that word, and return something like that “/%D0%BD%D0%BE%D0%B2%D0%BE%D1%81%D1%82%D0%B8/”.

    $nav_menu .= sprintf( $args->items_wrap, esc_attr( $wrap_id ), esc_attr( $wrap_class ), $items );

    As result, encoded url’s proceed by sprintf() through $args->items_wrap variable array row, that will be contain encoded url unicode entities from past wp_nav_menu() call (if i understood rightly), and they will be interpreted as patterns that must be filled by something on the second sprintf( $args->items_wrap ) run though second wp_nav_menu() call .

    I think that to solve this issue, % symbol must be escaped, for example through simple str_replace(“%”, “%%”); as I did.

    In file \wp-content\plugins\responsive-select-menu\responsive-select-menu.php on function display_element() i add str:
    $element->url = str_replace("%", "%%", $element->url);
    Result code is:

    function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
    
    		if ( !$element )
    			return;
    
    		global $responsiveMenuSelect;
    
    		if( $responsiveMenuSelect->getSettings()->op( 'uber-enabled' ) ){
    
    			$id_field = $this->db_fields['id'];
    			$id = $element->$id_field;
    
    			$display_on = apply_filters( 'uberMenu_display_item' , true , $this , $element , $max_depth, $depth, $args );
    
    			if( !$display_on ){
    				$this->clear_children( $children_elements , $id );
    				return;
    			}
    		}
    
    		$element->url = str_replace("%", "%%", $element->url);
    		Walker_Nav_Menu::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
    		//UberMenuWalker::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
    	}

    I can’t give guarantee, that this “hack” will be good in every issue, but in my issue, i get menu generator that working now.

    I’m really sorry for my English is bad. I’m was a bad student, just because of i couldn’t understand why i must be good student…
    So, parents! Please make your childrens to feel and to breathe life, and do not teach your childrens to be just a calculator whether capitalist.
    Good luck! I wish you health!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Error Warning: sprintf() [function.sprintf]’ is closed to new replies.