Bug Not all achievements calculated in certain condition

Status
Not open for further replies.

cdprojektred

Customer
Hello,
There is a hard to explain problem with data integrity, let me show it in a pseudocode:

In class_core.php:check_feature_by_typenames():
self::verify_rewards_cache($userinfo);
at this point $userinfo['dbtech_vbactivity_rewardscache'] is an array, good!

then in:
foreach ($features as $featureid) {
check_feature() call check_criteria()

if (!is_array($userinfo['dbtech_vbactivity_rewardscache']))
... break; // if this occur you stop checking rest of achievements
}


Most critera types do something like this:
type/dayregistered.php:check_criteria():

if (!$userinfo['joindate'])
{
// We need more info
$userinfo = array_merge($userinfo, fetch_userinfo($userinfo['userid']));
}

A this point $userinfo['dbtech_vbactivity_rewardscache'] is again serialized php string not an array what cause break foreach loop in check_feature_by_typenames() above

This causes a problem that very often only the first achievement will be checked. If the first check_feature() fail, then other will be skipeed.
 
That's quite interesting, I really appreciate the detailed explanation :D

I believe I've fixed it by simply reversing the arguments to array_merge, so the fetch_userinfo([...]) comes first. This should overwrite the serialized php string with the unserialized value from $userinfo.

The affected files from /dbtech/vbactivity/type/ are:
  • activitylevel.php
  • dayregistered.php
  • friend.php
  • gottenrep.php
  • lastpost.php
  • lastvisit.php
  • mentionsreceived.php
  • post.php
  • shout.php
  • tagsreceived.php
  • totalpoints.php

Let me know if this works for you :)


PS: Is it May 19th yet? ;)
 
Status
Not open for further replies.

Legacy vBActivity & Awards

vBulletin 3.8.x vBulletin 4.x.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
1,726
Customer rating
0.00 star(s) 0 ratings
Back
Top