TransWikia.com

How to resolve Array to string conversion error

CiviCRM Asked on December 28, 2021

  1. I’m sending a .ods file name into the makeFileName method to get a unique string value for the file name. but it return a file name which is not ending in .ods instead it end with .unknown.

    Ex: template_ods_65c986571c9c2737fff370ce4a745015.unknown

    but i need a file name like template_65c986571c9c2737fff370ce4a745015.ods.

  2. Other thing is when i assign a returned string value into a variable, it gives me the array to string conversion error.
    code

    $newName = CRM_Utils_File::makeFileName($value[‘name’]);

    Error

Array to string conversion in
/var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
on line 554

Warning: htmlspecialchars() expects parameter 1 to be string, array
given in
/var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php
on line 556

I confused with these two error, i’ll appreciate if someone could help me to resolve it

One Answer

For the first question you can go to Administer - System Settings - Safe File Extensions and add .ods to the list there.

For the second one is $value['name'] actually a string or is it an array?

Answered by Demerit on December 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP