Error fixIndexArrayFormat() in DBManager.php:1041

After an upgrade ran sour. Still cannot upgrade anymore. A quick rebuild will fail at the vardev comparison and just hang there. The only error in the logs is

[05-Jun-2020 12:48:05 UTC] PHP Fatal error: Uncaught Error: Call to undefined function fixIndexArrayFormat() in D:\CRM\SugarCRM\apps\SuiteCRM\htdocs\include\database\DBManager.php:1041

I am on Version 7.11.8
Apache/2.4.26 (Win64)
Server version: 5.6.23 - MySQL Community Server
Server charset: UTF-8 Unicode (utf8)

Has anyone an idea what could be wrong?

What version did you upgrade from/to?

Did you take a backup of your system prior to upgrade?

Did you try reentering the upgrade wizard? even if this means allowing the page to refresh for 10-15 minutes on the admin view after clicking the upgrade wizard link? If you get into upgrade wizard what do you see? are you back at beginning on a certain step?

See my comment here

Work-around would be to add this function into your file include/utils/array_utils.php:

function fixIndexArrayFormat($indexArray)
    foreach ($indexArray as $key => $value) {
        $indexArray[$key] = preg_replace("/\s+/u", " ", $value);
        $indexArray[$key] = trim($indexArray[$key]);
        $indexArray[$key] = str_replace(['( ', ' )'], ['(', ')'], $indexArray[$key]);
    return $indexArray;

I was upgrading from 7.11.8 to 7.11.10. when I start the Wizard I am back to the system check just like usual. I have a daily incremental backup.

I have added the code, but still the same

Just for reference, this is being discussed here:

@svdkar maybe the best thing would be copy that code to the top of /include/database/DBManager.php, outside the class, right below the <?php tag. That should work. After the upgrade succeeds, put the file back the way it was.

Thanks to the added code to the array_utils I could progress on the upgrade It not freezing anymore, but now gives the following error
File cannot be moved or written to: D:/CRM/SugarCRM/apps/SuiteCRM/htdocs/cache/upgrades/temp/7524.tmp/SuiteCRM-Upgrade-7.11.x-to-7.11.10/vendor/google/apiclient-services/src/Google/Service/Dialogflow/GoogleCloudDialogflowV2beta1IntentMessageBrowseCarouselCardBrowseCarouselCardItemOpenUrlAction.php

I recommend deleting the entire cache/upgrades/temp directory before starting, Old interrupted upgrades will fill that temporary directory with crap. Lots of it.

Are you upgrading to 7.11.10? Why not the latest?

Try again and tell me if the error stays the same, ok?

Had to cancel the upgrade a few times to keep it clean. Tried again after deleting the temp from the upgrades in the cache directory with the latest upgrade but same error with the preflight
File cannot be moved or written to: D:/CRM/SugarCRM/apps/SuiteCRM/htdocs/cache/upgrades/temp/65A2.tmp/SuiteCRM-Upgrade-7.11.x-to-7.11.13/vendor/google/apiclient-services/src/Google/Service/Dialogflow/GoogleCloudDialogflowV2beta1IntentMessageBrowseCarouselCardBrowseCarouselCardItemOpenUrlAction.php

And I see this error in the wizard log
Fri, 05 Jun 2020 20:40:54 +0000 [UpgradeWizard] - looking for schema script at: D:/CRM/SugarCRM/apps/SuiteCRM/htdocs/cache/upgrades/temp/65A2.tmp/scripts/650_to_7110_mysql.sql
Fri, 05 Jun 2020 20:40:54 +0000 [UpgradeWizard] - no schema script found - all schema preflight skipped

And this one in the php_erors log

[05-Jun-2020 20:41:10 UTC] PHP Notice: Undefined index: additional_step in D:\CRM\SugarCRM\apps\SuiteCRM\htdocs\modules\UpgradeWizard\index.php on line 291

I think that stupidly long file name simply blows Windows limit which is 260 chars for path+filename. So it can’t copy the file.

Most of what is in the vendor directory is not even needed… we need one Google API, and composer brings in all of them… sigh…

Try doing the upgrade steps one by one, and keep an eye on the cache/upgrades/temp directory. When you see that it has the zip already uncompressed, but before it tries copying, delete the entire directory called


and then click to proceed in the Wizard

Thanks !! That did the trick I could upgrade to the latest and do a quick repair.

1 Like