Skip to content

Duplicate declaration of static variable $sfh error #629

Description

@ddrewpublic

Issue

On a fresh install of SuiteCRM-8.7.1, install fails via both GUI and CLI with error

 php.CRITICAL: Fatal Compile Error: Duplicate declaration of static variable $sfh {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/modules/AOW_WorkFlow/aow_utils.php:645)"}

Possible Fix

  • comment out line 645 in /var/www/suitecrm/public/legacy/modules/AOW_WorkFlow/aow_utils.php

This gets me further, but causes other problems down the line.

[2025-03-12 13:21:57] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: "Invalid CSRF token" at CSRFValidationListener.php line 95 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException(code: 0): Invalid CSRF token at /var/www/suitecrm/core/backend/Security/CSRFValidationListener.php:95)"} []
[2025-03-12 13:21:57] request.CRITICAL: Uncaught PHP Exception Error: "Call to a member function call_custom_logic() on null" at AuthenticationController.php line 325 {"exception":"[object] (Error(code: 0): Call to a member function call_custom_logic() on null at /var/www/suitecrm/public/legacy/modules/Users/authentication/AuthenticationController.php:325)"} []
[2025-03-12 13:22:50] php.CRITICAL: Fatal Compile Error: Duplicate declaration of static variable $sfh {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/include/InlineEditing/InlineEditing.php:294)"} []
[2025-03-12 13:22:50] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Compile Error: Duplicate declaration of static variable $sfh" at InlineEditing.php line 294 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/include/InlineEditing/InlineEditing.php:294)"} []

Steps to Reproduce the Issue

### The setup:

- Ubuntu 20.04.6
- mysql  Ver 8.0.41
- Apache/2.4.41 
- PHP 8.3.17


### Pre-install:
- deleted any previous install directories
- dropped any previous install database & users
- installed any missing php modules (*php-imap*, *imagick*, *soap*) (including for php 8.2)
- updated php.ini (cli, fpm, apache2) increasing limits for file size, execution time etc...
- created *new_database* in mysql
- created *db_admin* user, with all grants on new_database
    - passwords all alphanumeric, no special characters, < 40 characters long
- created `suitecrm` directory & unzipped `SuiteCRM-8.7.1.zip`
- changed all files & folder permissions & ownership
- made `./bin/console` executable
- updated suitecrm apache2 conf Directory directives with paths & permissions
- restart *apache2*, *mysql*, *php8.3-fpm*, *php8.2-fpm*

### Install attempt 1 - GUI:

- navigate to *suitecrm.mysite.com*
- ✅ all checks pass 

- enter configuration details & proceed
- ❌ LBL_ACTION_ERROR

#### Troubleshooting:

- entries in `./public/legacy/suitecrm.log`
    Wed Mar 12 12:15:17 2025 [188705][-none-][FATAL] Mysqli_query failed.
    Wed Mar 12 12:15:17 2025 [188705][-none-][FATAL]  Query Failed: SELECT id FROM outbound_email WHERE type = 'system' AND deleted = 0: MySQL error 1146: Table 'suitecrmdb.outbound_email' doesn't exist
    
- SELECT COUNT(*) AS table_count FROM information_schema.tables WHERE table_schema = 'suitecrmdb';
+-------------+
| table_count |
+-------------+
|          78 |
+-------------+

- creating the table manually in mysql (using the schema at https://schema--suitecrm-docs.netlify.app/schema/tables/outbound_email)
- ❌ SuiteCRM Installation has been Disabled


- entries in ./logs/prod/prod.log

    [2025-03-12 12:27:55] php.CRITICAL: Fatal Compile Error: Duplicate declaration of static variable $sfh {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/modules/AOW_WorkFlow/aow_utils.php:645)"} []
    [2025-03-12 12:27:55] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Compile Error: Duplicate declaration of static variable $sfh" at aow_utils.php line 645 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/modules/AOW_WorkFlow/aow_utils.php:645)"} []

- ./logs/install.log
    [2025-03-12 12:27:18] install.log.ERROR: Your config.php does not exist. This will be created on install.Path Checked: legacy/config.php [] []
- ✅ checked & nothing lokos obviously wrong in the dbconfig array.


- ./public/legacy/install.log
`sudo -u www-data grep "creating\ table" ./public/legacy/install.log | wc -l`
- ❌ only 61 tables prestent (this appears to be inconsistent

- /var/log/apache2/error.suitecrm.mysite.com.log
- ❌ PHP Fatal error:  Uncaught Exception: Database failure.
- ❌ PHP message: PHP Fatal error:  Uncaught Exception: Database failure. Please refer to suitecrm.log for details



### Install attempt 1 - CLI:

- ❌ 12:48:26 CRITICAL  [php] Fatal Compile Error: Duplicate declaration of static variable $sfh ["exception" => Symfony\Component\ErrorHandler\Error\FatalError^ { …}]
    In aow_utils.php line 645:
    Compile Error: Duplicate declaration of static variable $sfh  

#### Troubleshooting:

- other than timestamps, the errors are pretty much the same, except for ./logs/prod/prod.log which has a lot of cache write warnings (and the same critical php error)

    [2025-03-12 12:48:23] cache.WARNING: Failed to save key "property_metadata_5a775e912f5d8a4579a3af9365eafbbf" of type ApiPlatform\Metadata\ApiProperty: fopen(/var/www/suitecrm/cache/prod/pools/system/8pqP3v6mg-/DrBu4l8T): Failed to open stream: No such file or directory {"key":"property_metadata_5a775e912f5d8a4579a3af9365eafbbf","exception":"[object] (ErrorException(code: 0): fopen(/var/www/suitecrm/cache/prod/pools/system/8pqP3v6mg-/DrBu4l8T): Failed to open stream: No such file or directory at /var/www/suitecrm/vendor/symfony/cache/Traits/FilesystemCommonTrait.php:95)","cache-adapter":"Symfony\\Component\\Cache\\Adapter\\PhpFilesAdapter"} []


### Fixes attempted

I've even gone so far as to manually create all 220 tables described in the schema docs, which got me nowhere.

Editing out line 645 in /var/www/suitecrm/public/legacy/modules/AOW_WorkFlow/aow_utils.php has things running  to the point of being able to see a login screen if I install via the CLI but there is another error:

- ❌ Login credentials incorrect, please try again.

and the cache warnings still exist.

Trying via the GUI leads to login errors, with the logs


[2025-03-12 13:21:57] request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: "Invalid CSRF token" at CSRFValidationListener.php line 95 {"exception":"[object] (Symfony\\Component\\HttpKernel\\Exception\\AccessDeniedHttpException(code: 0): Invalid CSRF token at /var/www/suitecrm/core/backend/Security/CSRFValidationListener.php:95)"} []
[2025-03-12 13:21:57] request.CRITICAL: Uncaught PHP Exception Error: "Call to a member function call_custom_logic() on null" at AuthenticationController.php line 325 {"exception":"[object] (Error(code: 0): Call to a member function call_custom_logic() on null at /var/www/suitecrm/public/legacy/modules/Users/authentication/AuthenticationController.php:325)"} []




[2025-03-12 13:22:50] php.CRITICAL: Fatal Compile Error: Duplicate declaration of static variable $sfh {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/include/InlineEditing/InlineEditing.php:294)"} []
[2025-03-12 13:22:50] request.CRITICAL: Uncaught PHP Exception Symfony\Component\ErrorHandler\Error\FatalError: "Compile Error: Duplicate declaration of static variable $sfh" at InlineEditing.php line 294 {"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Compile Error: Duplicate declaration of static variable $sfh at /var/www/suitecrm/public/legacy/include/InlineEditing/InlineEditing.php:294)"} []

Context

No response

Version

8.7.1

What browser are you currently using?

Firefox

Browser Version

Firefox 135.0.1

Environment Information

mysql Ver 8.0.41, Apache/2.4.41, PHP 8.3.17,

Operating System and Version

Ubuntu 20.04.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: PHP8Issues & PRs related to the CRM when using PHP8Status:Requires UpdatesIssues & PRs which requires input or update from the authorType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions