1 marbella Nov 05, 2010 12:58
3 sam2kb Nov 05, 2010 22:23
Try this
if( ! isset($number_of_posts_in_cat[$Chapter->ID]) ) $number_of_posts_in_cat[$Chapter->ID] = -1;
$r .= '<td class="center">'.(int)$number_of_posts_in_cat[$Chapter->ID].'</td>';
Then check the category that has "-1" posts, it's probably messed up.
4 sam2kb Nov 05, 2010 22:25
Do I need more recent php or MYSQL ?
No doubt you should update to at least PHP 5.2 and MySQL 5.0
5 blueyed Dec 06, 2010 16:16
Replying to a PM here:
PHP 4.x is still supported by b2evolution (as far as I know), but I would always recommend the latest PHP (5.3.4 is about to get released).
This is not related to this bug however, a proposed fix was posted by Alex (sam2kb) - I have not verified it myself though.
6 marbella Dec 06, 2010 19:07
many thanx for your certainly competent help!
but I am not as deep into b2 as you, so where should I put that ? File ? Line ?
if( ! isset($number_of_posts_in_cat[$Chapter->ID]) ) $number_of_posts_in_cat[$Chapter->ID] = -1;
$r .= '<td class="center">'.(int)$number_of_posts_in_cat[$Chapter->ID].'</td>';
sure, I understand servers always should be upto date but I run a shared server in a hosting farm- so updateing to me means:
moving to another server in the same park - getting new IP - trouble with A.records, possible Sand-box in Google etc... so I would prefer avoiding a update of PHP and SQL if not REALLY needed!
7 blueyed Dec 07, 2010 00:32
Alex proposed to add the first line just above the second one.
The problem here is just that the $number_of_posts_in_cat array/map has no entry for the chapter in question (ID 20, therefore the "undefined index" notice).
The extra line ("if( ! isset ... )") just sets it to -1 in that case.
Looking at the current code in CVS (development version), it looks like there's still the same problem (as long as $number_of_posts_in_cat gets not handled differently).
(Here is a link to see the current file: https://github.com/whissip/whissip/blob/cvs-mirror/blogs/inc/chapters/views/_chapter_list.view.php#L116 (github mirror)).
Is there something special about your category with ID 20?
Does it not exist anymore, but gets called somehow?
8 blueyed Dec 07, 2010 00:48
Ok, looking at the code, this "global" $number_of_posts_in_cat only gets in this file and is the result of a left join (database).
This means that the category in question just has no posts assigned to it, and the notice is only cosmetic.
Instead of assigning -1 in that case, it should be "0".
I fixed it using "-" instead: https://github.com/whissip/whissip/commit/5e82f45dd918d8b96b85fb17f9837980ef71a6e7
You should be able to apply either this fix, or the one mentioned by Alex manually.
Please note that I won't commit anything to b2evo itself, so unless Alex fixes it in CVS, it might be still there with the next release.
9 sam2kb Jan 02, 2011 03:32
Fixed in CVS
This looks like a bug, I'll check it.