Bug #41657

ActionRequest does not resolve correctly cased package key

Added by Jan-Erik Revsbech almost 3 years ago. Updated over 2 years ago.

Status:Resolved Start date:2012-10-07
Priority:Must have Due date:
Assigned To:Jan-Erik Revsbech % Done:

100%

Category:Package
Target version:-
PHP Version: Complexity:easy
Has patch:No Affected Flow version:Git 1.2 (master)

Description

The methods createPackage in class TYPO3\Flow\Package\PackageManage no longers generates the Package.php. The kickstart:package command uses this methods when kickstarting new packages, and the missing Package.php lead to seemingly unrelated errors like not not being able to correctly translate lower-case packagename to correct packagename.

I'm not sure why the file is no longer generated, it seems to be in relation to the Composer changes of the PackageManager, and it might very well be by intention.

If its by intention, we need to change the setControllerPackageKey of ActionRequest, since it calls the ObjectManger->getCaseSensitiveObjectName looking for the Package class, which when missing fails to find the correct PackageKey.

Anyone knows if its by intention it was omitted from the packagemanager?


Related issues

related to TYPO3 Flow Base Distribution - Story #41031: Composer support for packaging Resolved 2012-09-17

Associated revisions

Revision b744c359
Added by Jan-Erik Revsbech almost 3 years ago

[BUGFIX] ActionRequest does not resolve correctly cased package key

ActionRequest resolves lowercased package key by looking for
Package class instead of asking PackageManager. If no Package class
exists in the given Package, the request fails.

Resolves: #41657
Releases: 1.2
Change-Id: I5dd4e4e251f77dd104f0fcedfd4f9af852b368c3

History

#1 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from New to Under Review

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

#2 Updated by Jan-Erik Revsbech almost 3 years ago

It seems to be intentional that the Package.php is not generated.

If the Package.php class i optional, then I think its an error that setControllerPackageKey on the ActionRequest uses uses ObjectManager->getCaseSensitiveObjectName to retrieve the actual package key, or am I totally missing something?

public function setControllerPackageKey($packageKey) {
$upperCamelCasedPackageClassName = $this->objectManager->getCaseSensitiveObjectName(str_replace('.', '\\', $packageKey) . '\Package');
$this->controllerPackageKey = ($upperCamelCasedPackageClassName !== FALSE) ? substr(str_replace('\\', '.', $upperCamelCasedPackageClassName), 0, strlen($packageKey)) : $packageKey;
}

#3 Updated by Christopher Hlubek almost 3 years ago

  • Priority changed from Should have to Must have

Yes, it seems like the usage of getCaseSensitiveObjectName always expects a class named Package. We have to fix this behavior and use the correction of the package key inside the PackageManager (getCaseSensitivePackageKey).

Jan-Erik Revsbech wrote:

It seems to be intentional that the Package.php is not generated.

If the Package.php class i optional, then I think its an error that setControllerPackageKey on the ActionRequest uses uses ObjectManager->getCaseSensitiveObjectName to retrieve the actual package key, or am I totally missing something?

public function setControllerPackageKey($packageKey) {
$upperCamelCasedPackageClassName = $this->objectManager->getCaseSensitiveObjectName(str_replace('.', '\\', $packageKey) . '\Package');
$this->controllerPackageKey = ($upperCamelCasedPackageClassName !== FALSE) ? substr(str_replace('\\', '.', $upperCamelCasedPackageClassName), 0, strlen($packageKey)) : $packageKey;
}

#4 Updated by Christopher Hlubek almost 3 years ago

  • Subject changed from PackageManager->createPackage does not create Package.php file to ActionRequest does not resolve correctly cased package key

#5 Updated by Gerrit Code Review almost 3 years ago

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

#6 Updated by Jan-Erik Revsbech almost 3 years ago

Christopher Hlubek wrote:

Yes, it seems like the usage of getCaseSensitiveObjectName always expects a class named Package. We have to fix this behavior and use the correction of the package key inside the PackageManager (getCaseSensitivePackageKey).

I submitted a patch set correcting the behaviour of the ActionRequest. I was unaware of the getCaseSensitivePackageKey method of the PackageManager.

#7 Updated by Gerrit Code Review almost 3 years ago

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

#8 Updated by Gerrit Code Review almost 3 years ago

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

#9 Updated by Gerrit Code Review almost 3 years ago

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

#10 Updated by Anonymous almost 3 years ago

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

#11 Updated by Karsten Dambekalns over 2 years ago

  • Assigned To set to Jan-Erik Revsbech

Also available in: Atom PDF