Project

General

Profile

Actions

Bug #24204

closed

Wrong internal object references after cloning tslib_cObj instances

Added by Ingo Renner over 13 years ago. Updated about 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Communication
Target version:
-
Start date:
2010-11-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.0
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When cloning an instance of tslib_cObj PHP (in the nature of a clone) copies all the properties of the original instance to the clone instance.

$original->contentObjects contains references to instances of tslib_content_*, these instances of tslib_content_* have back references to their parent tslib_cObj instance. Now when cloning, instead of pointing to the new $clone tslib_cObj instance, these tslib_content_* instances still point the $original tslib_cObj. This causes major problems resulting in rendering of the frontend hitting maximum execution time or memory limits and still not rendering the expected content.

The behavior can be tested with EXT:kb_nescefe v1.1.1

The solution is to reset $clone>contentObjects using PHP's magic __clone() method so that no references are left to $original->contentObject

1)
==============================================================================
$cObjA (tslib_cObj) <------------------------|
|                                            |
|$cObjA->contentObjects[]                    |
|--------------> CASE (tslib_content_Case) --|
|--------------> USER (tslib_content_User) --|
|--------------> HTML (tslib_content_Html) --|
|--------------> TEXT (tslib_content_Text) --|

2)
==============================================================================
$cObjB = clone $cObjA;

3)
==============================================================================
$cObjA (tslib_cObj) <------------------------|
|                                            |       $cObjA->contentObjects[]!
|                                            |             ^
|--------------> CASE (tslib_content_Case) --|  XXX  <-----|
|--------------> USER (tslib_content_User) --|  XXX  <-----|
|--------------> HTML (tslib_content_Html) --|  XXX  <-----|
|--------------> TEXT (tslib_content_Text) --|  XXX  <-----|
                                                           |
$cObjB (tslib_cObj) ---------------------------------------|

(issue imported from #M16568)

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #23162: Refactoring of content objects of tslib_contentClosedSteffen Kamper2010-07-13

Actions
Actions #1

Updated by Ingo Renner over 13 years ago

committed to trunk (4.5) in r9624

Actions #2

Updated by Susanne Moog about 13 years ago

  • Target version deleted (4.5.0)
Actions

Also available in: Atom PDF