WCF icon indicating copy to clipboard operation
WCF copied to clipboard

UserOption::getOptionByName(optionname) loads wrong table

Open Oski19831 opened this issue 3 years ago • 0 comments

The DatabaseObject wcf\data\user\option\UserOption extends wcf\data\option\Option

The Static Method getOptionByName loads all Data from Table ´"wcf"_ . WCF_N . "Option"´.

So this static Method is not usefull in UserOption.

So i Changed the Method to:

public static function getOptionByName($optionName)
 {
     $sql = "SELECT  *
             FROM    " . self::getDatabaseTableName() . "
             WHERE   optionName = ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute([$optionName]);

     return $statement->fetchObject(self::class);
 }

Oski19831 avatar Sep 01 '22 11:09 Oski19831