Bug #45876

Exception in TypeHandling with PHP < 5.3.7

Added by Mattias Nilsson over 2 years ago. Updated over 2 years ago.

Status:Resolved Start date:2013-02-27
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Utility
Target version:-
PHP Version:5.3 Complexity:
Has patch:No Affected Flow version:(any)

Description

When adding new content in Neos an exception is thrown. Refrencing to the file: TYPO3.Flow/Classes/TYPO3/Flow/Utility/TypeHandling.php

ExtDirect error: Uncaught exception #1 (ref 2013022708244558d7f1) - Warning: Unknown class passed as parameter in /Applications/MAMP/htdocs/phoenix.dev/Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Utility/TypeHandling.php line 118

Screen_Shot_2013-02-27_at_8.24.52_AM.png (111.4 kB) Mattias Nilsson, 2013-02-27 08:27

Screen_Shot_2013-02-27_at_2.57.58_PM.png (325.3 kB) Mattias Nilsson, 2013-02-27 14:58


Related issues

related to TYPO3.Flow - Bug #44535: Subclasses of SplObjectStorage, ArrayObject, Collection n... Resolved 2013-01-15

Associated revisions

Revision 57a78d3b
Added by Mattias Nilsson over 2 years ago

[BUGFIX] Exception thrown in TypeHandling

When using isCollectionType() on an unknown class, an exception is
caused by a warning PHP gives about that class being unknown.

The issue has been introduced together with the patch
I007b0faf486680ecfb2fe7c753ef4cabcf6d618c

This adds a check that the element is a known class before using
is_subclass_of() to prevent the exception.

Change-Id: Iae59221cbd72677e6c18ad0a383792a798447253
Fixes: #45876
Releases: master, 2.0, 1.1

Revision 5772372b
Added by Benno Weinzierl over 2 years ago

[BUGFIX] Exception thrown in TypeHandling (follow up)

When using isCollectionType() on an string, a warning is thrown.
The change id Iae59221cbd72677e6c18ad0a383792a798447253 introduced this.

Change-Id: Idb1a18fddae425fe03c4c1102c22133d716a6b65
Resolves: #45876
Releases: master, 2.0, 1.1

Revision 988e05c2
Added by Mattias Nilsson over 2 years ago

[BUGFIX] Exception thrown in TypeHandling

When using isCollectionType() on an unknown class, an exception is
caused by a warning PHP gives about that class being unknown.

The issue has been introduced together with the patch
I007b0faf486680ecfb2fe7c753ef4cabcf6d618c

This adds a check that the element is a known class before using
is_subclass_of() to prevent the exception.

Change-Id: Iae59221cbd72677e6c18ad0a383792a798447253
Fixes: #45876
Releases: master, 2.0, 1.1

Revision 2a8841d3
Added by Benno Weinzierl over 2 years ago

[BUGFIX] Exception thrown in TypeHandling (follow up)

When using isCollectionType() on an string, a warning is thrown.
The change id Iae59221cbd72677e6c18ad0a383792a798447253 introduced this.

Change-Id: Idb1a18fddae425fe03c4c1102c22133d716a6b65
Resolves: #45876
Releases: master, 2.0, 1.1

Revision d555f69b
Added by Mattias Nilsson over 2 years ago

[BUGFIX] Exception thrown in TypeHandling

When using isCollectionType() on an unknown class, an exception is
caused by a warning PHP gives about that class being unknown.

The issue has been introduced together with the patch
I007b0faf486680ecfb2fe7c753ef4cabcf6d618c

This adds a check that the element is a known class before using
is_subclass_of() to prevent the exception.

Change-Id: Iae59221cbd72677e6c18ad0a383792a798447253
Fixes: #45876
Releases: master, 2.0, 1.1

Revision e402ec24
Added by Benno Weinzierl over 2 years ago

[BUGFIX] Exception thrown in TypeHandling (follow up)

When using isCollectionType() on an string, a warning is thrown.
The change id Iae59221cbd72677e6c18ad0a383792a798447253 introduced this.

Change-Id: Idb1a18fddae425fe03c4c1102c22133d716a6b65
Resolves: #45876
Releases: master, 2.0, 1.1

History

#1 Updated by Mattias Nilsson over 2 years ago

  • Tracker changed from Task to Bug
  • Project changed from Base Distribution to TYPO3.Neos

#2 Updated by Mattias Nilsson over 2 years ago

The same error occurs when entering the Site Management Module. Url: neos/administration/sites/edit?moduleArguments[site][__identity]=indentitykey

#1: Warning: Unknown class passed as parameter in /Applications/MAMP/htdocs/phoenix.dev/Base/Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Utility/TypeHandling.php line 118 (More information)

#3 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#4 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#5 Updated by Gerrit Code Review over 2 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#6 Updated by Gerrit Code Review over 2 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#7 Updated by Benno Weinzierl over 2 years ago

The current patchset fails in my installation (LAMP) because the following Type is not recognized as Collection:
Doctrine\ORM\PersistentCollection

IMHO is_subclass_of is not enough, it should also be checked for interfaces

#8 Updated by Gerrit Code Review over 2 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#9 Updated by Karsten Dambekalns over 2 years ago

Benno Weinzierl wrote:

The current patchset fails in my installation (LAMP) because the following Type is not recognized as Collection:
Doctrine\ORM\PersistentCollection

IMHO is_subclass_of is not enough, it should also be checked for interfaces

Not needed after 5.3.7:

php -a
Interactive shell

php > var_dump(is_subclass_of('ArrayObject', 'ArrayAccess'));
bool(true)

The question is, when can we finally raise the minimum required PHP version to something sane?

#10 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from New to Needs Feedback
  • Assigned To set to Karsten Dambekalns

What PHP version are you running?

#11 Updated by Benno Weinzierl over 2 years ago

Karsten Dambekalns wrote:

What PHP version are you running?

Jup! I am running 5.3.6...

#12 Updated by Karsten Dambekalns over 2 years ago

  • Project changed from TYPO3.Neos to TYPO3.Flow

#13 Updated by Karsten Dambekalns over 2 years ago

  • Subject changed from Exception when adding new content to Exception in TypeHandling with PHP < 5.3.7
  • Category set to Utility
  • PHP Version set to 5.3
  • Has patch set to No
  • Affected Flow version set to (any)

#14 Updated by Karsten Dambekalns over 2 years ago

  • Status changed from Needs Feedback to Under Review

#15 Updated by Gerrit Code Review over 2 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#16 Updated by Gerrit Code Review over 2 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18556

#17 Updated by Ottmar Biebersdorf over 2 years ago

Karsten Dambekalns wrote:

The question is, when can we finally raise the minimum required PHP version to something sane?

I hope not as long as many production servers are using the current Debian (Squeeze) which uses PHP 5.3.3 at the moment. It would exclude many production servers from beeing able to run Flow or Neos. So please wait a little longer. Thanks.

#18 Updated by Mattias Nilsson over 2 years ago

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

#19 Updated by Benno Weinzierl over 2 years ago

not fixed in my installation. Get Error:

#1: Warning: class_implements() [<a href='function.class-implements'>function.class-implements</a>]: Class string does not exist and could not be loaded in .../Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Utility/TypeHandling.php line 128

Should look like this:


    static public function isCollectionType($type) {
        if (in_array($type, self::$collectionTypes, TRUE)) {
            return TRUE;
        }

        if (class_exists($type) === TRUE) {
            foreach (self::$collectionTypes as $collectionType) {
                if (is_subclass_of($type, $collectionType) === TRUE) {
                    return TRUE;
                }
            }

                // is_subclasss_of does not check for interfaces in PHP < 5.3.7
            if (version_compare(PHP_VERSION, '5.3.7', '<') === TRUE) {
                foreach (self::$collectionTypes as $collectionType) {
                    if (in_array($collectionType, class_implements($type)) === TRUE) {
                        return TRUE;
                    }
                }
            }
        }

        return FALSE;
    }

#20 Updated by Adrian Föder over 2 years ago

  • Status changed from Resolved to Under Review

reopened on behalf of Benno

#21 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18900

#22 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18900

#23 Updated by Benno Weinzierl over 2 years ago

  • Status changed from Under Review to Resolved

#24 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19055

#25 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19056

#26 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19057

#27 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19058

#28 Updated by Benno Weinzierl over 2 years ago

  • Status changed from Under Review to Resolved

#29 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19058

#30 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch FLOW3-1.1 has been pushed to the review server.
It is available at https://review.typo3.org/19057

#31 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch composer has been pushed to the review server.
It is available at https://review.typo3.org/19349

#32 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch composer has been pushed to the review server.
It is available at https://review.typo3.org/19352

#33 Updated by Benno Weinzierl over 2 years ago

  • Status changed from Under Review to Resolved

Also available in: Atom PDF