PDA

View Full Version : Glitch with using items


Hall of Famer
04-11-2012, 01:11 AM
The item system is glitchy in a way that it cannot distinguish owners
As Silverdragontears was reporting problems of her using certain items, I found a serious mistake within the file classes/class_item.php. The problem is with the constructor, as it grabs item info from inventory solely based on the itemname, but not itemowner. For this reason only the first user to ever purchase it from itemshop can use it. It is hilarious when other users attempt to use the item, they see a list of pets that do not belong to themselves at all.

I've reuploaded Mys v1.3.1 to fix this glitch for good, and I apologize for this mistake. Again it was caused by the fact that it was only me on my dev demo site, which makes debugging over features that involve multiple users difficult and sometimes impossible. I will upload the new classes/class_item.php a few minutes later, it is actually quite easy to fix though if you wanna do it manually.

Silver Kitsune
04-11-2012, 01:49 AM
What are the edits?

Hall of Famer
04-11-2012, 01:55 AM
This is the difference from line 97 of the two versions:

Old version:

$row = $GLOBALS['adopts']->select("inventory", array(), "itemname ='{$itemname}'")->fetchObject();
New version:

$row = $GLOBALS['adopts']->select("inventory", array(), "itemname ='{$itemname}' and owner = '{$itemowner}'")->fetchObject();
The old version does not check the item owner, which was perfectly fine for table prefix.items but not for prefix.inventory. The itemname alone is insufficient to identify each item in inventory, it must be coupled with itemowner. In the old script it will be a problem if you have two or more users buying the same items(as the script cannot distinguish the owners), the new script resolve this issue.

Silver Kitsune
04-11-2012, 01:57 AM
Ok I changed it but you still can't target the adopts.

Hall of Famer
04-11-2012, 03:16 AM
Then you are probably having a different issue. This one is related to how the system is unable to identify item owners because the info is not executed by the constructor.

Silver Kitsune
04-11-2012, 03:17 AM
Do I start a bug report for it or what?

Hall of Famer
04-11-2012, 03:28 AM
umm I dont think you should unless it is confirmed to be a glitch in the script. If it affects your site because your adoptable ids are not numeric, its better to ask in questions/support section. But yeah, if a few hours later I confirm this is a glitch that affects everyone, you may go ahead and start a bug report.

Iris-spider
09-11-2012, 04:31 PM
The current link to upload 1.3.1 has this problem fixed, correct?

Hall of Famer
09-14-2012, 02:03 AM
I think so, please let me know if it is still not fixed.