Skip to content

ClassCacheManager merge generates duplicate initializeObject() in tx_news_domain_model_news.php #2785

@can0199

Description

@can0199

Bug Report

Current Behavior
When extending GeorgRinger\News\Domain\Model\News via
$GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['classes'] and defining initializeObject() in the extending class, TYPO3 crashes with:

Fatal error: Cannot redeclare GeorgRinger\News\Domain\Model\News::initializeObject() in var/cache/code/news/tx_news_domain_model_news.php

The generated proxy class contains initializeObject() more than once.

Expected behavior/output
Extending the News model with its own initializeObject() should not produce duplicate method declarations in the generated proxy class.
A single valid merged initializeObject() method (or another safe conflict handling) is expected.

Environment

  • TYPO3 version(s): 14.1
  • news version: 14.0.1
  • Is your TYPO3 installation set up with Composer (Composer Mode): yes
  • OS: Linux 6.8.0-64-generic with ddev

Possible Solution
Adjust ClassCacheManager add exception in merging for the function initializeObject() similar to the logic for __construct function

Additional context
I believe this problem was introduced when this PR was merged: #2722

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions