<commit_before><?php

namespace wcf\system\option;

use wcf\data\option\Option;
use wcf\system\WCF;

/**
 * Option type implementation for float values.
 *
 * @author  <NAME>
 * @copyright   2001-2011 <NAME>
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Option
 */
class FloatOptionType extends TextOptionType
{
    /**
     * @inheritDoc
     */
    protected $inputClass = 'short textRight';

    /**
     * @inheritDoc
     */
    public function getFormElement(Option $option, $value)
    {
        $value = \str_replace('.', WCF::getLanguage()->get('wcf.global.decimalPoint'), $value);

        return parent::getFormElement($option, $value);
    }

    /**
     * @inheritDoc
     */
    public function getData(Option $option, $newValue)
    {
        return $this->toFloat($newValue);
    }

    /**
     * @inheritDoc
     */
    public function compare($value1, $value2)
    {
        if ($value1 == $value2) {
            return 0;
        }

        return ($value1 > $value2) ? 1 : -1;
    }

    /**
     * Converts a localized string value into a float value.
     */
    private function toFloat($value): float
    {
        $value = \str_replace(' ', '', $value);
        $value = \str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $value);
        $value = \str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $value);

        return \floatval($value);
    }
}
<commit_msg>Missing conversion of localized search values<commit_after><?php

namespace wcf\system\option;

use wcf\data\option\Option;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\WCF;
use wcf\util\StringUtil;

/**
 * Option type implementation for float values.
 *
 * @author  <NAME>
 * @copyright   2001-2011 <NAME>
 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
 * @package WoltLabSuite\Core\System\Option
 */
class FloatOptionType extends TextOptionType
{
    /**
     * @inheritDoc
     */
    protected $inputClass = 'short textRight';

    /**
     * @inheritDoc
     */
    public function getFormElement(Option $option, $value)
    {
        $value = \str_replace('.', WCF::getLanguage()->get('wcf.global.decimalPoint'), $value);

        return parent::getFormElement($option, $value);
    }

    /**
     * @inheritDoc
     */
    public function getData(Option $option, $newValue)
    {
        return $this->toFloat($newValue);
    }

    /**
     * @inheritDoc
     */
    public function compare($value1, $value2)
    {
        if ($value1 == $value2) {
            return 0;
        }

        return ($value1 > $value2) ? 1 : -1;
    }

    /**
     * @inheritDoc
     */
    public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value)
    {
        if (!isset($_POST['searchOptions'][$option->optionName])) {
            return false;
        }

        $value = StringUtil::trim($value);
        $value = $this->toFloat($value);

        $conditions->add("option_value.userOption" . $option->optionID . " LIKE ?", [$value]);
        return true;
    }

    /**
     * Converts a localized string value into a float value.
     */
    private function toFloat($value): float
    {
        $value = \str_replace(' ', '', $value);
        $value = \str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $value);
        $value = \str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $value);

        return \floatval($value);
    }
}

{'fraction_non_alphanumeric': 0.1552486187845304, 'fraction_numerical': 0.009392265193370166, 'mean_word_length': 2.6029850746268655, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3436397', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1096, 'n_words': 223}