ZF-11466: Zend_Tool_Project_Provider_Controller checks for existing controller before canonicalizing name

Description

When creating controllers with:

{{zf create action}}

we can sometimes override existing controller (without any warning).

To override controller {{LoremController.php}} type the command:

{{zf create controller lorem}}

or

{{zf create controller}}

and then when prompted type:

{{lorem}}

Comments

The issue here is that it appears zf create controller checks to see if the controller exists before it's converted to canonical form.

Reproduced below against trunk:


[adam@zfdev zf]$ zf create project ZF-11466
[adam@zfdev ZF-11466]$ zf create controller Test
Creating a controller at /tmp/zf/ZF-11466/application/controllers/TestController.php
Creating an index action method in controller Test
Creating a view script for the index action method at /tmp/zf/ZF-11466/application/views/scripts/test/index.phtml
Creating a controller test file at /tmp/zf/ZF-11466/tests/application/controllers/TestControllerTest.php
Updating project profile '/tmp/zf/ZF-11466/.zfproject.xml'

[adam@zfdev ZF-11466]$ zf create controller Test
                          An Error Has Occurred
 This project already has a controller named Test

Zend Framework Command Line Console Tool v1.11.0dev
Details for action "Create" and provider "Controller"
  Controller
    zf create controller name index-action-included[=1] module

[adam@zfdev ZF-11466]$ zf create controller test
Note: The canonical controller name that is used with other providers is "Test"; not "test" as supplied
Creating a controller at /tmp/zf/ZF-11466/application/controllers/TestController.php
Creating an index action method in controller Test
Creating a view script for the index action method at /tmp/zf/ZF-11466/application/views/scripts/test/index.phtml
Creating a controller test file at /tmp/zf/ZF-11466/tests/application/controllers/TestControllerTest.php
Updating project profile '/tmp/zf/ZF-11466/.zfproject.xml'

zf create controller Test run twice will trigger an error the second time, but running zf create controller test subsequent to that will overwrite the existing TestController, despite the fact that all three reference the same controller.

Fixed in trunk r24135 Merged to release-1.11 in r24136

Thanks for your bug report.