What happened?
Description
I use the dateOrdered field in a filename for a PDF and convert it with |date:
Invoice-{dateOrdered|date('d_m_Y')}
After updating from Craft CMS 5.8.17 to 5.9.16 and from Craft Commerce 5.4.6 to 5.6, I get following error when trying to generate the PDF:

dateOrdered seems to be converted to an array at this point. Dumping the value of dateOrdered shows the following:
array:2 [▼
"date" => "16.03.2026"
"time" => "12:16"
]
In earlier versions dateOrdered would have been a DateTime object and could have been converted with the date filter.
I think the bug got introduced the method renderObjectTemplate of src/web/View.php in Craft CMS: craftcms/cms@20563bd Switching the if statements in the current version for $object instanceof Model and $object instanceof Arrayable fixes the issue for me.
I was not able to reproduce the bug using only Craft CMS atm. Maybe there is some overlap with Craft Commerce.
Steps to reproduce
- Create a PDF (e.g. an invoice) with a filename containing
{dateOrdered|date('d_m_Y')}
- Download the PDF
Expected behavior
Filename of the PDF is something like "18_03_2026".
Actual behavior
Exception gets thrown: Array to string conversion
Craft CMS version
5.9.16
Craft Commerce version
5.6
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions
"require": {
"craftcms/ckeditor": "4.11.3",
"craftcms/cms": "5.9.16",
"craftcms/commerce": "^5.6.0",
"craftcms/commerce-stripe": "5.1.0.3",
"enupal/translate": "4.1.2",
"ether/seo": "5.0.0",
"ibericode/vat": "^1.2",
"mmikkel/cp-clearcache": "2.0.1",
"studioespresso/craft-dumper": "5.0.1",
"twig/string-extra": "^3.19",
"vlucas/phpdotenv": "^5.4.0"
},
"require-dev": {
"craftcms/generator": "^2.0.0",
"yiisoft/yii2-shell": "^2.0.3"
},
What happened?
Description
I use the
dateOrderedfield in a filename for a PDF and convert it with|date:Invoice-{dateOrdered|date('d_m_Y')}After updating from Craft CMS 5.8.17 to 5.9.16 and from Craft Commerce 5.4.6 to 5.6, I get following error when trying to generate the PDF:

dateOrderedseems to be converted to an array at this point. Dumping the value ofdateOrderedshows the following:In earlier versions
dateOrderedwould have been aDateTimeobject and could have been converted with the date filter.I think the bug got introduced the method
renderObjectTemplateofsrc/web/View.phpin Craft CMS: craftcms/cms@20563bd Switching the if statements in the current version for$object instanceof Modeland$object instanceof Arrayablefixes the issue for me.I was not able to reproduce the bug using only Craft CMS atm. Maybe there is some overlap with Craft Commerce.
Steps to reproduce
{dateOrdered|date('d_m_Y')}Expected behavior
Filename of the PDF is something like "18_03_2026".
Actual behavior
Exception gets thrown:
Array to string conversionCraft CMS version
5.9.16
Craft Commerce version
5.6
PHP version
8.3
Operating system and version
No response
Database type and version
No response
Image driver and version
No response
Installed plugins and versions