When I place a VCF file with a street address in a map's directory, I get the following error screen:
Long story short, I traced it down to lib/Controller/ContactsController.php:303. The fourth argument to vCardToArray() - i.e. $adrtype - is expected to be a string, but it's converted to an array in this call.
When I replace
$result[] = $this->vCardToArray($file, $vcard, $geo, array($adrtype), $adr->getValue(), $file->getId());
with
$result[] = $this->vCardToArray($file, $vcard, $geo, $adrtype, $adr->getValue(), $file->getId());
it works just fine.
Steps to reproduce
Create a new map in the Maps app
Open folder
Drag'n'drop a vcf file with an "ADR" record into the folder
Reload Maps app in browser
Expected behavior
Address from VCF contact should just show in the map
Installation method
Manual installation
Operating system
RHEL/CentOS
PHP engine version
Other
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install of the server?
None
Is this bug present after an update or on a fresh install of the app?
{"reqId":"wgYgGexEuyLJLe3nc8IK","level":3,"time":"2023-11-04T13:18:37+00:00","remoteAddr":"***REDACTED***","user":"***REDACTED***","app":"index","method":"GET","url":"/index.php/apps/maps/contacts?myMapId=361339","message":"OCA\\Maps\\Controller\\ContactsController::vCardToArray(): Argument #4 ($adrtype) must be of type ?string, array given, called in /home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php on line 303 in file '/home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 344","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36","version":"27.1.3.2","exception":{"Exception":"Exception","Message":"OCA\\Maps\\Controller\\ContactsController::vCardToArray(): Argument #4 ($adrtype) must be of type ?string, array given, called in /home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php on line 303 in file '/home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php' line 344","Code":0,"Trace":[{"file":"/home/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/www/nextcloud/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"TypeError","Message":"OCA\\Maps\\Controller\\ContactsController::vCardToArray(): Argument #4 ($adrtype) must be of type ?string, array given, called in /home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php on line 303","Code":0,"Trace":[{"file":"/home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php","line":303,"function":"vCardToArray","class":"OCA\\Maps\\Controller\\ContactsController","type":"->"},{"file":"/home/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getContacts","class":"OCA\\Maps\\Controller\\ContactsController","type":"->"},{"file":"/home/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/home/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/home/www/nextcloud/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/home/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/home/www/nextcloud/apps/maps/lib/Controller/ContactsController.php","Line":344},"CustomMessage":"--"}}
⚠️ This issue respects the following points: ⚠️
Bug description
When I place a VCF file with a street address in a map's directory, I get the following error screen:
Long story short, I traced it down to
lib/Controller/ContactsController.php:303
. The fourth argument to vCardToArray() - i.e. $adrtype - is expected to be a string, but it's converted to an array in this call.When I replace
$result[] = $this->vCardToArray($file, $vcard, $geo, array($adrtype), $adr->getValue(), $file->getId());
with$result[] = $this->vCardToArray($file, $vcard, $geo, $adrtype, $adr->getValue(), $file->getId());
it works just fine.Steps to reproduce
Expected behavior
Address from VCF contact should just show in the map
Installation method
Manual installation
Operating system
RHEL/CentOS
PHP engine version
Other
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install of the server?
None
Is this bug present after an update or on a fresh install of the app?
Fresh Nextcloud Maps install (never installed before)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Browser Console
Additional info
PHP Version: 8.2.11