extcode / cart

Cart is a small but powerful extension which "solely" adds a shopping cart to your TYPO3 installation. The extension allows you to create coupons, products with or without variants, special prices.
GNU General Public License v2.0
57 stars 51 forks source link

PHP Warning Undefined array key "until" #551

Closed matin73 closed 3 months ago

matin73 commented 4 months ago

Core: Error handler (FE): PHP Warning: Undefined array key "until" in ...extcode/cart/Classes/Domain/Model/Cart/Service.php line 22

rintisch commented 4 months ago

@matin73 Can you please make a full bug report with the given template? I do not understand your error and for the current main branch there is no array key on line 22.

matin73 commented 4 months ago

sorry, is line 228

matin73 commented 4 months ago

` Get help in the TYPO3 Documentation

If you need help solving this exception, you can have a look at the TYPO3 Documentation. There you can find solutions provided by the TYPO3 community. Once you have found a solution to the problem, help others by contributing to the documentation page.

Find a solution for this exception in the TYPO3 Documentation. (1/1) #1476107295 TYPO3\CMS\Core\Error\Exception

PHP Warning: Undefined array key "until" in /xxxx/vendor/extcode/cart/Classes/Domain/Model/Cart/Service.php line 228 in /xxxx/vendor/typo3/cms-core/Classes/Error/ErrorHandler.php line 138

    }

    $message = self::ERROR_LEVEL_LABELS[$errorLevel] . ': ' . $errorMessage . ' in ' . $errorFile . ' line ' . $errorLine;
    if ($errorLevel & $this->exceptionalErrors) {
        throw new Exception($message, 1476107295);
    }

    $message = $this->getFormattedLogMessage($message);

at TYPO3\CMS\Core\Error\ErrorHandler->handleError() in /xxxx/vendor/extcode/cart/Classes/Domain/Model/Cart/Service.php line 228

        if (isset($freeFrom) && $this->cart->getGross() < (float)$freeFrom) {
            return false;
        }

        $freeUntil = $this->config['free']['until'];
        if (isset($freeUntil) && $this->cart->getGross() > (float)$freeUntil) {
            return false;
        }

at Extcode\Cart\Domain\Model\Cart\Service->isFree() in /xxxx/vendor/extcode/cart/Classes/Domain/Model/Cart/Service.php line 241

}

protected function getExtra(): Extra
{
    if ($this->isFree()) {
        return new Extra(
            0,
            0,
            0.0,

at Extcode\Cart\Domain\Model\Cart\Service->getExtra() in /xxxx/vendor/extcode/cart/Classes/Domain/Model/Cart/Service.php line 69

}

public function getGross(): float
{
    $extra = $this->getExtra();

    $extraGross = $this->cart->translatePrice($extra->getGross());

    if ($extra->getExtraType() === 'each') {

at Extcode\Cart\Domain\Model\Cart\Service->getGross() in /xxxx/vendor/typo3fluid/fluid/src/Core/Variables/StandardVariableProvider.php line 145

        if (is_object($subject)) {
            $upperCasePropertyName = ucfirst($pathSegment);
            $getMethod = 'get' . $upperCasePropertyName;
            if (method_exists($subject, $getMethod)) {
                $subject = $subject->$getMethod();
                continue;
            }
            $isMethod = 'is' . $upperCasePropertyName;
            if (method_exists($subject, $isMethod)) {

at TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider->getByPath() in /xxxx/vendor/typo3fluid/fluid/src/Core/Variables/ScopedVariableProvider.php line 102

{
    $path = $this->resolveSubVariableReferences($path);
    $identifier = explode('.', $path, 2)[0];
    return $this->localVariables->exists($identifier)
        ? $this->localVariables->getByPath($path)
        : $this->globalVariables->getByPath($path);
}

public function getAllIdentifiers(): array

at TYPO3Fluid\Fluid\Core\Variables\ScopedVariableProvider->getByPath() in /xxxx/var/cache/code/fluid_template/partial_Cart_OrderForm_ShippingMethod_08b23444a4d8f846.php line 268

'then' => function() use ($renderingContext) { return call_user_func_array( function ($var) { return (is_string($var) || (is_object($var) && method_exists($var, 'toString')) ? htmlspecialchars((string) $var, ENT_QUOTES) : $var); }, [$renderingContext->getVariableProvider()->getByPath('shipping.net')]); }, 'else' => function() use ($renderingContext) { return call_user_func_array( function ($var) { return (is_string($var) || (is_object($var) && method_exists($var, 'toString')) ? htmlspecialchars((string) $var, ENT_QUOTES) : $var); }, [$renderingContext->getVariableProvider()->getByPath('shipping.gross')]); }, ];

$output25 .= TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper::renderStatic($arguments26, static fn() => '', $renderingContext)

at partial_Cart_OrderForm_ShippingMethod_08b23444a4d8f846->{closure}() in /xxxx/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractConditionViewHelper.php line 103

    }
    if (!empty($arguments['__else'])) {
        // The condition argument evaluated to false. If there is
        // an f:else body closure, return its executed body.
        return $arguments['__else']();
    }
    return '';
}

at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper::renderStatic() in /xxxx/var/cache/code/fluid_template/partial_Cart_OrderForm_ShippingMethod_08b23444a4d8f846.php line 272

return call_user_func_array( function ($var) { return (is_string($var) || (is_object($var) && method_exists($var, '__toString')) ? htmlspecialchars((string) $var, ENT_QUOTES) : $var); }, [$renderingContext->getVariableProvider()->getByPath('shipping.gross')]); }, ];

$output25 .= TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper::renderStatic($arguments26, static fn() => '', $renderingContext) ;

$output25 .= ' ';

at partial_Cart_OrderForm_ShippingMethod_08b23444a4d8f846->{closure}() in /xxxx/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 293

public function renderChildren()
{
    if ($this->renderChildrenClosure !== null) {
        $closure = $this->renderChildrenClosure;
        return $closure();
    }
    return $this->viewHelperNode->evaluateChildNodes($this->renderingContext);
}

at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->renderChildren() in /xxxx/vendor/extcode/cart/Classes/ViewHelpers/Format/CurrencyViewHelper.php line 146

    $thousandsSeparator = $thousandsSeparator ?? ',';
    $decimalSeparator = $decimalSeparator ?? '.';
    $decimals = $decimals ?? 0;

    $floatToFormat = $this->renderChildren();
    if (empty($floatToFormat)) {
        $floatToFormat = 0.0;
    } else {
        $floatToFormat = (float)$floatToFormat;

at Extcode\Cart\ViewHelpers\Format\CurrencyViewHelper->render()`

rintisch commented 4 months ago

Thanks for your feedback. But I did not mean that I can help best of you use the big report template. There you would for example have to write when the error occurs, which version you are using and so on. Please provide these information. You get the bug report template when opening a new bug report.

matin73 commented 4 months ago

filling bug report for small problem ... ok so I will open a second bug report. please have a look at line 228 - indefined array key is not working in php 8: $freeUntil = $this->config['free']['until'];

rintisch commented 3 months ago

Closed for follow-up #552