Bug Report
Current Behavior
When generating order/invoice/delivery numbers without a configured suffix (or prefix), the following PHP warning is logged:
PHP Warning: Undefined array key "suffix" in Classes/EventListener/Order/Create/Number.php line 48
Expected behavior/output
No warning should be raised when prefix/suffix are not configured in TypoScript; the number should simply be generated without them.
Environment
- TYPO3 version(s): 14.3
- cart version: ^12.0
- Is your TYPO3 installation set up with Composer (Composer Mode): yes
- OS: Windows 11 (via ddev/Docker)
Possible Solution
Classes/EventListener/Order/Create/Number.php (abstract base class for OrderNumber, InvoiceNumber, DeliveryNumber) accesses $this->options['prefix'] and $this->options['suffix'] directly without checking whether the keys exist:
return implode('', [
is_string($this->options['prefix']) ? $this->options['prefix'] : '',
$number,
is_string($this->options['suffix']) ? $this->options['suffix'] : '',
]);
Suggested fix:
return implode('', [
is_string($this->options['prefix'] ?? null) ? $this->options['prefix'] : '',
$number,
is_string($this->options['suffix'] ?? null) ? $this->options['suffix'] : '',
]);
Additional context
Occurs whenever a site's TypoScript configuration for number generation omits prefix and/or suffix.
Bug Report
Current Behavior
When generating order/invoice/delivery numbers without a configured
suffix(orprefix), the following PHP warning is logged:PHP Warning: Undefined array key "suffix" in Classes/EventListener/Order/Create/Number.php line 48Expected behavior/output
No warning should be raised when
prefix/suffixare not configured in TypoScript; the number should simply be generated without them.Environment
Possible Solution
Classes/EventListener/Order/Create/Number.php(abstract base class forOrderNumber,InvoiceNumber,DeliveryNumber) accesses$this->options['prefix']and$this->options['suffix']directly without checking whether the keys exist:Suggested fix:
Additional context
Occurs whenever a site's TypoScript configuration for number generation omits
prefixand/orsuffix.