Bug #40263
Code migration script destroys method name in Resource\Resource
Status: | Resolved | Start date: | 2012-08-27 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
Category: | - Migrations - | |||
Target version: | TYPO3 Flow Base Distribution - 1.1.1 | |||
PHP Version: | 5.3 | Complexity: | ||
Has patch: | No | Affected Flow version: | FLOW3 1.1.0 |
Description
Okay, please be kind in case i missed something..
I am new to FLOW3 an just wanted to migrate my small Package to 1.1.
Everything went fine an changes took place after core:migrate.
The problem I see is, in the mentioned Class, there is a doublette for method getMediaType() which the parser (5.3.10) doesnt like very much :-)
The compatibility version of PHP is (according to the download page) 5.3.2-5.4.x so there should be no redeclarations in the code.
It should be safe to remove the first doublette. Afterwards, the project compiled fine.
Here's the old method:
/** * Returns the mime type for this resource * * @return string The mime type * @deprecated since 1.1.0 * @see getMediaType() */ public function getMediaType() { return $this->getMediaType(); }
Associated revisions
[BUGFIX] Loop confuses variable check on migrating
When migrating code and not specifying a package to work on, the code
would get confused after the first available migration, because the
internal loop used $packageKey as well.
Change-Id: Ie680e8b54f4ffc069edc6b1896b803e53cfacb0c
Related: #40263
Releases: 1.1, 1.2
[BUGFIX] Loop confuses variable check on migrating
When migrating code and not specifying a package to work on, the code
would get confused after the first available migration, because the
internal loop used $packageKey as well.
Change-Id: Ie680e8b54f4ffc069edc6b1896b803e53cfacb0c
Related: #40263
Releases: 1.1, 1.2
History
#1 Updated by Cedric Ziel almost 3 years ago
It's not the old, but the doublette-sorry.
#2 Updated by Adrian Föder almost 3 years ago
Cedric, this is strange, the method you've mentioned should be "getMimeType", hence not a duplicate is present.
the Code I have is
1 /**
2 * Returns the mime type for this resource
3 *
4 * @return string The mime type
5 * @deprecated since 1.1.0
6 * @see getMediaType()
7 */
8 public function getMimeType() {
9 return $this->getMediaType();
10 }
11
12 /**
13 * Returns the Media Type for this resource
14 *
15 * @return string The IANA Media Type
16 */
17 public function getMediaType() {
18 return MediaTypes::getMediaTypeFromFilename('x.' . $this->getFileExtension());
19 }
can you confirm you are on lastest master [correction: the correct 1.1, if so] and didn't mistaken something?
Also 1.1 is correct in code: http://git.typo3.org/FLOW3/Packages/TYPO3.FLOW3.git?a=blob;f=Classes/Resource/Resource.php;h=1cddf03e289659b32dfac879ab60e93095f23885;hb=FLOW3-1.1#l111
#3 Updated by Adrian Föder almost 3 years ago
- Category set to Resource
- Status changed from New to Needs Feedback
- Assigned To set to Adrian Föder
#4 Updated by Cedric Ziel almost 3 years ago
Hello,
thanks for your response. Is there any chance, the migrate task is involved?
I double-checked it and can confirm this method doesn't exist in the src-package I downloaded.
#5 Updated by Adrian Föder almost 3 years ago
hey that's a good point, thanks for that hint, I will check this.
#6 Updated by Cedric Ziel almost 3 years ago
I double-checked it-the migrate task replaces getMimeType with getMediaType in the method signature.
#7 Updated by Adrian Föder almost 3 years ago
- Status changed from Needs Feedback to Accepted
- Priority changed from Should have to Must have
well yes of course, that's it pretty surely:
#8 Updated by Adrian Föder almost 3 years ago
- Subject changed from Doubled function getMediaType() in TYPO3\FLOW3\Resource\Resource to Code migration script destroys method name in Resource\Resource
- Assigned To deleted (
Adrian Föder)
#9 Updated by Gerrit Code Review almost 3 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/14133
#10 Updated by Adrian Föder almost 3 years ago
Cedric, if you are able to do, may I please to to test whether the provided patch resolves your issue?
If so, feel free to review the patch set.
Thanks a lot for your help!
#11 Updated by Karsten Dambekalns almost 3 years ago
- Category changed from Resource to - Migrations -
- Status changed from Under Review to Needs Feedback
- Assigned To set to Karsten Dambekalns
Well, anything inside "Framework" is skipped by the migration tool, so I wonder why it even worked on that piece of code.
#12 Updated by Cedric Ziel almost 3 years ago
Hmm well what information do You need?
I read the Upgrade.txt, moved copied over the new Source Files and did the migration task. That's all for reproducing the issue ^^
#13 Updated by Karsten Dambekalns almost 3 years ago
Your FLOW3 package is in Packages/Framework
? Do you still have the output of the migrate command?
#14 Updated by Cedric Ziel almost 3 years ago
Yes. Packages/Framework
Here's the output befor the patch (it was not the first try..As you can see in my Package. But better than nothing.-It shows the relevant part.)
➜ f3finances git:(master) ./flow3 core:migrate Applying TYPO3.FLOW3-201201261636 Migrating Cziel.F3finances No changes were committed. ------------------------------------------------------------------------------- Notes ------------------------------------------------------------------------------- * \TYPO3\FLOW3\MVC\Web\RequestBuilder does not exist anymore. If you need to create requests, do "new ActionRequest($parentRequest)". * \TYPO3\FLOW3\MVC\Web\SubRequestBuilder does not exist anymore. If you need to create sub requests, do "new ActionRequest($parentRequest)". * \TYPO3\FLOW3\MVC\RequestInterface has been removed, use \TYPO3\FLOW3\Mvc\ActionRequest instead - e.g. if you implemented your own token. * Handling of NULL values in the database has changed, add "@ORM\Column(nullable=true)" to properties that need to be nullable or give them a non-NULL default. * All persistence repositories must be of scope "singleton", this is now enforced. Add "@FLOW3\Scope("singleton")" if not already present. * $supportedRequestTypes are not needed anymore in a controller. * Validators now accept empty values by default, if you need the previous behavior, add "@FLOW3\Validate(type="NotEmpty")" where needed. * Settings.yaml: The previously shipped "DefaultProvider" authentication provider configuration has been removed, you must configure all providers yourself now. * Settings.yaml: "providerClass" is deprecated, use "provider" instead. Provider options are now given in "providerOptions". * Settings.yaml: Authentication "entryPoint" configuration needs to be changed from: entryPoint: WebRedirect: uri: login.html to: entryPoint: 'WebRedirect' entryPointOptions: uri: 'login.html' * Routes.yaml: Widget configuration needs to be adjusted to refer to the correct widget id, see upgrading instructions. ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- Warnings ------------------------------------------------------------------------------- * Class names in pointcut expressions might not be fully qualified, check manually whether (more) adjustments are needed. ------------------------------------------------------------------------------- Done with TYPO3.FLOW3-201201261636 Applying TYPO3.Fluid-201205031303 Migrating TYPO3.FLOW3 No changes were committed. ------------------------------------------------------------------------------- Notes ------------------------------------------------------------------------------- * Widget configuration has changed, you might want to add "widgetId" attributes to your widget inclusions in Fluid templates. Adjust Routes.yaml as needed! ------------------------------------------------------------------------------- Done with TYPO3.Fluid-201205031303 Applying TYPO3.FLOW3-201205292145 Migrating TYPO3.FLOW3 [master af18deb] [TASK] Apply migration TYPO3.FLOW3-201205292145 1 file changed, 1 insertion(+), 1 deletion(-) Done with TYPO3.FLOW3-201205292145 Applying TYPO3.FLOW3-201206271128 Migrating TYPO3.FLOW3 No changes were committed. Done with TYPO3.FLOW3-201206271128 ➜ f3finances git:(master) ./flow3 PHP Fatal error: Cannot redeclare TYPO3\FLOW3\Resource\Resource::getMediaType() in /home/cziel/src/f3finances/Packages/Framework/TYPO3.FLOW3/Classes/Resource/Resource.php on line 120
#15 Updated by Karsten Dambekalns almost 3 years ago
- Status changed from Needs Feedback to Under Review
- Target version set to 1.1.1
Ok, please check https://review.typo3.org/14134 and see if that helps. Classic looping error… :/
#16 Updated by Adrian Föder almost 3 years ago
but, just asking: the SearchAndReplace, does this really a brute force string replacement? If so, looking for actual invocations by ->
is worth a consideration IMO.
But I don't know if the migration manager already does some magic on its own regarding this.
#17 Updated by Karsten Dambekalns almost 3 years ago
Adrian Föder wrote:
but, just asking: the SearchAndReplace, does this really a brute force string replacement? If so, looking for actual invocations by
->
is worth a consideration IMO.
Yes, SearchAndReplace does exactly what you tell it to do. I just commented on the first change in Gerrit regarding this.
#18 Updated by Karsten Dambekalns almost 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100