Review main Merged

26999[BUGFIX] Invalid class name to file path conversion

Xavier Perseguers CR +2 V +2 Easy +3 −1 updated 01/25/14, 15:46

Commit message

The conversion from a class name such as
tx_extensionname_domain_model_somename to its corresponding PHP file
does not take Extbase naming conventions for the file name. This yields
an wrongly-cased file name which will be validated anyway on case
insensitive file systems.

This wrong conversion may lead to a PHP fatal error
Cannot redeclare class VendorName\Extension\Domain\Model\Somename

Review

  • Code review CR +2
    • Xavier Perseguers +2
    • Stefan Neufeind +1
    • Markus Klein +1
    • Marcin Sągol +1
  • Verified V +2
    • Xavier Perseguers +2
    • Markus Klein +1
    • Marcin Sągol +1

Files 1

Review log 15

  1. Mr. Jenkins commented on patch set 1 01/22/14, 17:40

  2. Markus Klein commented on patch set 1 01/22/14, 18:53

    ClassLoader.php:338

    Why translating the string again? $classNameWithoutVendorAndProduct = strtr(ucwords(strtr($classNameWithoutVendorAndProduct, $delimiter, LF)), LF, '/'); $classFilePath = $classesPath . $classNameWithoutVendorAndProduct . '.php';
  3. Xavier Perseguers commented on patch set 1 01/22/14, 18:59

    ClassLoader.php:338 Reply

    you're right ;)
  4. Xavier Perseguers uploaded patch set 2 01/22/14, 19:02

  5. Markus Klein commented on patch set 2 CR +1 01/22/14, 19:03

    How to verify?
  6. Xavier Perseguers commented on patch set 2 01/22/14, 19:14

    2 ways: on case sensitive filesystem, you should not see the cache for the corresponding class because it was wrongly computed, on case insensitive you had it but if you read it (typo3temp/Cache/Data/cache_classes/<classname> you'll see the path is obviously wrong. There are numerous articles on the internet telling that PHP fatals if you autoload a class (using proper file name) and do it again with a require that is the wrong file name since the path is not the same, it's not seen as already there. In my case, I have an Extbase extension with parent->child relations, IRRE, ... and while switching from a generic list to a details view with all children "resolved" and shown, I get this error as Extbase wants to convert the table name tx_extension_domain_model_whatever to the corresponding class name to populate the domain model and it hits the wrong cache entry, thus PHP fatals
  7. Mr. Jenkins commented on patch set 2 01/22/14, 19:15

  8. Markus Klein voted on patch set 2 V +1 01/22/14, 20:03

  9. Marcin Sągol voted on patch set 2 CR +1 01/22/14, 20:08

  10. Stefan Neufeind commented on patch set 2 CR +1 01/22/14, 23:50

    And 6.1/6.0? Or do you fear that would be "breaking"?
  11. Xavier Perseguers commented on patch set 2 01/23/14, 15:46

    Reply

    Did not have problem with 6.1, it's really after switching to 6.2 that problem appeared
  12. Markus Klein commented on patch set 2 01/23/14, 16:01

    Reply

    Classloader has been modified heavily in 6.2. Therefore I'm sure it only appies to 6.2
  13. Marcin Sągol voted on patch set 2 V +1 01/23/14, 16:15

  14. Xavier Perseguers voted on patch set 2 V +2 CR +2 01/25/14, 15:46

  15. Xavier Perseguers merged patch set 3 01/25/14, 15:46