Checklist
Baikal version
0.11.1
PHP version
8.,2
Steps to reproduce
Upload a VCF contact file from the Thunderbird E-Mail client to Baikal using the interface found at the /dav.php/addressbooks/[user]/default/.
Expected behaviour
The VCF file shall be imported.
Current behaviour
Baikal throws the error indicated in the logs section.
The problem seems to be line 248 that contains $valueParam = strtoupper($valueParam); within method getClassNameForPropertyValue. As I understand the error, some array gets passed as the variable $valueParam which makes PHP complain about strtoupper being limited to operate on strings.
Gemini A.I. suggested the change:
$valueParam = strtoupper((string)(is_array($valueParam) ? "" : $valueParam));
and it seems to fix the issue such that the VCF an be imported.
I thought about reporting it anyway because this fix does not seem too proper given that the meaning implied by getClassNameForPropertyValue excludes an array being passed to it and clearly there should be a better fix.
Logs
TypeError: strtoupper(): Argument #1 ($string) must be of type string, array given in /var/www/baikal/vendor/sabre/vobject/lib/Document.php:248\nStack trace:\n#0 /var/www/baikal/vendor/sabre/vobject/lib/Document.php(248): strtoupper()\n#1 /var/www/baikal/vendor/sabre/vobject/lib/Document.php(216): Sabre\\VObject\\Document->getClassNameForPropertyValue()\n#2 /var/www/baikal/vendor/sabre/vobject/lib/Parser/MimeDir.php(456): Sabre\\VObject\\Document->createProperty()\n#3 /var/www/baikal/vendor/sabre/vobject/lib/Parser/MimeDir.php(233): Sabre\\VObject\\Parser\\MimeDir->readProperty()\n#4 /var/www/baikal/vendor/sabre/vobject/lib/Parser/MimeDir.php(184): Sabre\\VObject\\Parser\\MimeDir->parseLine()\n#5 /var/www/baikal/vendor/sabre/vobject/lib/Parser/MimeDir.php(96): Sabre\\VObject\\Parser\\MimeDir->parseDocument()\n#6 /var/www/baikal/vendor/sabre/vobject/lib/Reader.php(47): Sabre\\VObject\\Parser\\MimeDir->parse()\n#7 /var/www/baikal/vendor/sabre/dav/lib/CardDAV/Plugin.php(328): Sabre\\VObject\\Reader::read()\n#8 /var/www/baikal/vendor/sabre/dav/lib/CardDAV/Plugin.php(296): Sabre\\CardDAV\\Plugin->validateVCard()\n#9 /var/www/baikal/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\\CardDAV\\Plugin->beforeCreateFile()\n#10 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(1094): Sabre\\DAV\\Server->emit()\n#11 /var/www/baikal/vendor/sabre/dav/lib/DAV/CorePlugin.php(504): Sabre\\DAV\\Server->createFile()\n#12 /var/www/baikal/vendor/sabre/event/lib/WildcardEmitterTrait.php(89): Sabre\\DAV\\CorePlugin->httpPut()\n#13 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(472): Sabre\\DAV\\Server->emit()\n#14 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(253): Sabre\\DAV\\Server->invokeMethod()\n#15 /var/www/baikal/vendor/sabre/dav/lib/DAV/Server.php(321): Sabre\\DAV\\Server->start()\n#16 /var/www/baikal/Core/Frameworks/Baikal/Core/Server.php(118): Sabre\\DAV\\Server->exec()\n#17 /var/www/baikal/html/dav.php(70): Baikal\\Core\\Server->start()\n#18 {main}
Checklist
Baikal version
0.11.1
PHP version
8.,2
Steps to reproduce
Upload a VCF contact file from the Thunderbird E-Mail client to Baikal using the interface found at the
/dav.php/addressbooks/[user]/default/.Expected behaviour
The VCF file shall be imported.
Current behaviour
Baikal throws the error indicated in the logs section.
The problem seems to be line
248that contains$valueParam = strtoupper($valueParam);within methodgetClassNameForPropertyValue. As I understand the error, some array gets passed as the variable$valueParamwhich makes PHP complain aboutstrtoupperbeing limited to operate on strings.Gemini A.I. suggested the change:
and it seems to fix the issue such that the VCF an be imported.
I thought about reporting it anyway because this fix does not seem too proper given that the meaning implied by
getClassNameForPropertyValueexcludes an array being passed to it and clearly there should be a better fix.Logs