Project

General

Profile

Actions

Bug #95819

closed

Extbase does not support uninitialized domain object properties

Added by Alexander Schnitzler over 2 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Should have
Category:
Extbase
Target version:
-
Start date:
2021-10-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

As of PHP 7.4, object properties can be defined with a property type and without a default value. This means, the property is uninitialized and needs to be initialized (a value must be set) before it can be accessed.

Example:

class Foo {

    protected string $string;
    protected ObjectStorage $items;

    public function __construct(string $string)
    {
        $this->string = $string;
        $this->items = new ObjectStorage();
    }

}

This is perfectly valid php code but as Extbase does not support detecting those properties, they are neither respected when saving an object to the database nor when reconstituting an object from a database row. Such properties then remain uninitialized and lead to fatal errors.

This is especially annoying when there is a desire to not set a default value like for ObjectStorages which have to be initialized with null although that is no desired state in any case:

class Foo {

    protected string $string;
    protected ?ObjectStorage $items = null;

    public function __construct(string $string)
    {
        $this->string = $string;
        $this->items = new ObjectStorage();
    }

}

To mitigate that issue, Extbase needs to rely on Reflection instead of method get_object_vars();


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #98148: Extbase persistence erronously tries to persist unmapped private property Closed2022-08-16

Actions
Related to TYPO3 Core - Bug #102278: Missing default value for property Container.php:$prototypeObjectsWhichAreCurrentlyInstanciated will lead to #1546632293 RuntimeException in GenericObjectValidator.phpResolved2023-10-27

Actions
Has duplicate TYPO3 Core - Bug #97646: Extbase property mapper does not work with uninitialized propertiesClosedSascha Egerer2022-05-17

Actions
Actions #1

Updated by Gerrit Code Review over 2 years ago

  • Status changed from New to Under Review

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #2

Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #3

Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #4

Updated by Gerrit Code Review over 2 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #5

Updated by Gerrit Code Review over 2 years ago

Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #6

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72526

Actions #7

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72536

Actions #8

Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #9

Updated by Witali Rott over 2 years ago

Sorry for the amount of patch sets, my first steps on gerrit. But the last patch set solves the problem: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #10

Updated by Stefan Bürk over 2 years ago

Wiali Rott, please do not any multiple tries (patches) for the same issues. As you see above, there was already a patch for that issue. Even before you added your first patch/approach. And now you have added a second one.

First of, it's not good to have have multiple patches for the same issue. At least, you could have tried out the first approach and test/verify it.

And instead of adding another patch (your second), you could have changed your first one and pushed a second patchset. and not a new patch add all. Meaning, checkout the first one, change your code, ammend it and push it again. That's described in the contribution guide.
Otherwise, you may ask for help in #typo3-cms-coredev channel on slack if something is unclear.

Least but not last, both of your patches went "red" on Core CI testing, meaning that the automaticlly tests failed.

edit

Just saw, your first patch has been gone. Have you abandoned it ?

Have you seen the other patch (9 patchsets) before your first try ? => https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #11

Updated by Witali Rott over 2 years ago

Sure i saw it, the first patch was one month ago, the last some days ago. With this bug is TYPO3 useless, i can't fixing all the extensions with empty model values. Therefore i make an clear patch that works.
I apologize once again for my several attempts with gerrit.

Actions #12

Updated by Gerrit Code Review over 2 years ago

Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #13

Updated by Gerrit Code Review over 2 years ago

Patch set 11 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #14

Updated by Gerrit Code Review over 2 years ago

Patch set 12 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #15

Updated by Gerrit Code Review over 2 years ago

Patch set 13 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #16

Updated by Gerrit Code Review over 2 years ago

Patch set 14 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #17

Updated by Gerrit Code Review over 2 years ago

Patch set 15 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #18

Updated by Gerrit Code Review over 2 years ago

Patch set 16 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #19

Updated by Gerrit Code Review over 2 years ago

Patch set 17 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #20

Updated by Sascha Egerer almost 2 years ago

  • Has duplicate Bug #97646: Extbase property mapper does not work with uninitialized properties added
Actions #21

Updated by Gerrit Code Review almost 2 years ago

Patch set 18 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #22

Updated by Gerrit Code Review almost 2 years ago

Patch set 19 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #23

Updated by Gerrit Code Review almost 2 years ago

Patch set 20 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72005

Actions #24

Updated by Gerrit Code Review almost 2 years ago

Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75363

Actions #25

Updated by Anonymous almost 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #26

Updated by Gerrit Code Review almost 2 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75364

Actions #27

Updated by Anonymous almost 2 years ago

  • Status changed from Under Review to Resolved
Actions #28

Updated by Oliver Hader over 1 year ago

  • Related to Bug #98148: Extbase persistence erronously tries to persist unmapped private property added
Actions #29

Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed
Actions #30

Updated by Gerrit Code Review about 1 year ago

  • Status changed from Closed to Under Review

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #31

Updated by Gerrit Code Review about 1 year ago

Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #32

Updated by Gerrit Code Review about 1 year ago

Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #33

Updated by Gerrit Code Review about 1 year ago

Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #34

Updated by Gerrit Code Review about 1 year ago

Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72537

Actions #35

Updated by Benni Mack 10 months ago

  • Status changed from Under Review to Closed
Actions #36

Updated by Tobi Ferger 7 months ago

  • Related to Bug #102278: Missing default value for property Container.php:$prototypeObjectsWhichAreCurrentlyInstanciated will lead to #1546632293 RuntimeException in GenericObjectValidator.php added
Actions

Also available in: Atom PDF