Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strpos() error on wc-term-functions.php line 372 version 2.1.9 #5490

Closed
SilverKenn opened this issue May 16, 2014 · 2 comments
Closed

strpos() error on wc-term-functions.php line 372 version 2.1.9 #5490

SilverKenn opened this issue May 16, 2014 · 2 comments

Comments

@SilverKenn
Copy link

Just updated woocommerce few minutes ago,

then I notice this error after update

Warning: strpos() [function.strpos]: Empty delimiter in /......./wp-content/plugins/woocommerce/includes/wc-term-functions.php on line 372 

Its this line,

// query fields
    if ( strpos( 'COUNT(*)', $clauses['fields'] ) === false )  {
        $clauses['fields']  .= ', tm.* ';
    }

it seems that $clauses['fields'] is empty,
so I just added another if statement before that line to disable error temporarily

if ( !empty($clauses['fields']) ) {
    if ( strpos( 'COUNT(*)', $clauses['fields'] ) === false )  {
      $clauses['fields']  .= ', tm.* ';
    }
 }

not really comfortable editing the plugin directly so I hope you guys can push a fix for this

Thanks

system info

WC Version: 2.1.9
WC Database Version:    2.1.9
WP Version: 3.9.1
WP Multisite Enabled:   No
Web Server Info:    Apache
PHP Version:    5.3.2-1ubuntu4.18
MySQL Version:  5.5.27
This was referenced May 19, 2014
@roykho roykho closed this as completed in a0bc882 May 22, 2014
mikejolley added a commit that referenced this issue May 22, 2014
[2.1.x] menu order terms were coming back empty fixes #5490
@nathanmarks
Copy link

This fix creates another bug.

In the link_all_variations function, when it calls wc_get_product_terms with the arguments set to return slugs, the changes made here to wc_get_product_terms cause it to return names and when it sanitizes those names, it causes terms that would have identical slugs (IE 2 x 8 & 2" x 8") to conflict, resulting in this sort of thing:

2014-06-02 at 9 46 am

This happens because 2-x-8 gets stored in the DB, even though the attribute for this product actually has the slug 2-x-8-2

@nathanmarks
Copy link

An easy fix would be to throw in

$args['fields']     = isset($args['fields']) && $args['fields'] == 'slugs' ? 'id=>slug' : 'names';

But this conditional is starting to look a bit messy/hacky, I don't have time to look at everything using this function but is there a better way to handle this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants