Oh my god. Thank you for bringing this to my attention… this is terribly embarrassing, and I guess we’ve all been very lucky that YARPP has continued to function in the mean time.
My understanding of the effect is that count((array) $weight['tax'])
was interpreted as count(array(0))
, and thus the term_relationships were being joined even when not necessary. Is that right? How did you find this?
Will fix in a quick bugfix release.
No, the other way around. It wasn’t adding the joins, so the query was failing. In fact, it wasn’t working at all for me when using the YARPP_Cache_Bypass (using yarpp_get_related manually). It was working on table cache, though, when using the auto add.
Didn’t test it, but http://plugins.svn.wordpress.org/yet-another-related-posts-plugin/tags/4.0.1b2/class-cache.php looks good.
So, you’re right about count(array(0)), but that’s 0, so it was not entering the IF.
count(array(0)) is 1 π so it was entering.
php -r 'var_dump(count($arr["bad_index"]));'
title:7: bad math expression: operand expected at
“bad_index…’
1;phpPHP Notice: Undefined variable: arr in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
Notice: Undefined variable: arr in Command line code on line 1
Call Stack:
0.0001 626184 1. {main}() Command line code:0
int(0)
`
it was not π
Hate the formatting for code. Let’s try again:
php -r ‘var_dump(count($arr[“bad_index”]));’
title:7: bad math expression: operand expected at `”bad_index…’
1;phpPHP Notice: Undefined variable: arr in Command line code on line 1
PHP Stack trace:
PHP 1. {main}() Command line code:0
Notice: Undefined variable: arr in Command line code on line 1
Call Stack:
0.0001 626184 1. {main}() Command line code:0
int(0)
well, $arr was defined, so I think it’s 1… but either way, can you confirm that this is fixed for 4.0.1?
Yup, working.
It’s weird, because I found the issue thanks to an error on my mysql log because of the missing join. Anyway, it’s fixed.
Thanks!
Great! Hoping to push this release tomorrow… want to let it bake a bit. If you want, the latest beta is b3:
http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.4.0.1b3.zip