Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

BC Break in Controller Loader, controllers no more present in controller loader. #3576

Closed
Freeaqingme opened this issue Jan 27, 2013 · 8 comments
Assignees
Milestone

Comments

@Freeaqingme
Copy link
Member

Hi,

I have the following code:

        $controllerLoader = $this->sm->get('controllerloader');
        $controllers = $controllerLoader->getServiceLocator()->getCanonicalNames();

Here the sm property represents the Service Manager. However, some entries (my controllers) that are present in 2.0.6, are no more so in develop.

Diff of the $controllers array:

-array(92) {
+array(102) {
   ["SharedEventManager"]=>
   string(18) "sharedeventmanager"
   ["EventManager"]=>
@@ -46,14 +46,30 @@ array(92) {
   string(13) "consolerouter"
   ["DependencyInjector"]=>
   string(18) "dependencyinjector"
+  ["DiAbstractServiceFactory"]=>
+  string(24) "diabstractservicefactory"
+  ["DiServiceInitializer"]=>
+  string(20) "diserviceinitializer"
+  ["DiStrictAbstractServiceFactory"]=>
+  string(30) "districtabstractservicefactory"
+  ["FilterManager"]=>
+  string(13) "filtermanager"
+  ["FormElementManager"]=>
+  string(18) "formelementmanager"
   ["HttpRouter"]=>
   string(10) "httprouter"
+  ["PaginatorPluginManager"]=>
+  string(22) "paginatorpluginmanager"
   ["Request"]=>
   string(7) "request"
   ["Response"]=>
   string(8) "response"
   ["Router"]=>
   string(6) "router"
+  ["RoutePluginManager"]=>
+  string(18) "routepluginmanager"
+  ["ValidatorManager"]=>
+  string(16) "validatormanager"
   ["ViewHelperManager"]=>
   string(17) "viewhelpermanager"
   ["ViewFeedRenderer"]=>
@@ -78,6 +94,8 @@ array(92) {
   string(16) "dispatchlistener"
   ["RouteListener"]=>
   string(13) "routelistener"
+  ["SendResponseListener"]=>
+  string(20) "sendresponselistener"
   ["Configuration"]=>
   string(13) "configuration"
   ["Console"]=>
@@ -100,18 +118,18 @@ array(92) {
   string(16) "controllerloader"
   ["config"]=>
   string(6) "config"
-  ["Application\Controller\Index"]=>
-  string(26) "applicationcontrollerindex"
-  ["Application\Controller\Api"]=>
-  string(24) "applicationcontrollerapi"
-  ["Application\Controller\Api\Website"]=>
-  string(31) "applicationcontrollerapiwebsite"
-  ["Application\Controller\Api\Website\User"]=>
-  string(35) "applicationcontrollerapiwebsiteuser"
   ["controllerpluginmanager"]=>
   string(23) "controllerpluginmanager"
   ["viewhelpermanager"]=>
   string(17) "viewhelpermanager"
+  ["validatormanager"]=>
+  string(16) "validatormanager"
+  ["filtermanager"]=>
+  string(13) "filtermanager"
+  ["formelementmanager"]=>
+  string(18) "formelementmanager"
+  ["routepluginmanager"]=>
+  string(18) "routepluginmanager"
   ["application"]=>
   string(11) "application"
   ["request"]=>
@@ -124,6 +142,8 @@ array(92) {
   string(16) "dispatchlistener"
   ["viewmanager"]=>
   string(11) "viewmanager"
+  ["sendresponselistener"]=>
+  string(20) "sendresponselistener"
   ["router"]=>
   string(6) "router"
   ["RouteNotFoundStrategy"]=>
@@ -185,10 +205,5 @@ array(92) {
   ["zendservicemanagerservicelocatorinterface"]=>
   string(41) "zendservicemanagerservicelocatorinterface"
 }
@weierophinney
Copy link
Member

Were those controllers managed via DI, by any chance? Ping @Ocramius

On Sunday, January 27, 2013, Dolf Schimmel wrote:

Hi,

I have the following code:

    $controllerLoader = $this->sm->get('controllerloader');
    $controllers = $controllerLoader->getServiceLocator()->getCanonicalNames();

Here the sm property represents the Service Manager. However, some entries
(my controllers) that are present in 2.0.6, are no more so in develop.

Diff of the $controllers array:

+array(102) {
["SharedEventManager"]=>
string(18) "sharedeventmanager"
["EventManager"]=>
@@ -46,14 +46,30 @@ array(92) {
string(13) "consolerouter"
["DependencyInjector"]=>
string(18) "dependencyinjector"
- ["DiAbstractServiceFactory"]=>
- string(24) "diabstractservicefactory"
- ["DiServiceInitializer"]=>
- string(20) "diserviceinitializer"
- ["DiStrictAbstractServiceFactory"]=>
- string(30) "districtabstractservicefactory"
- ["FilterManager"]=>
- string(13) "filtermanager"
- ["FormElementManager"]=>
- string(18) "formelementmanager" ["HttpRouter"]=> string(10)
  "httprouter"
- ["PaginatorPluginManager"]=>
- string(22) "paginatorpluginmanager" ["Request"]=> string(7)
  "request" ["Response"]=> string(8) "response" ["Router"]=> string(6)
  "router"
- ["RoutePluginManager"]=>
- string(18) "routepluginmanager"
- ["ValidatorManager"]=>
- string(16) "validatormanager" ["ViewHelperManager"]=> string(17)
  "viewhelpermanager" ["ViewFeedRenderer"]=> @@ -78,6 +94,8 @@ array(92) {
  string(16) "dispatchlistener" ["RouteListener"]=> string(13) "routelistener"
- ["SendResponseListener"]=>
- string(20) "sendresponselistener" ["Configuration"]=> string(13)
  "configuration" ["Console"]=> @@ -100,18 +118,18 @@ array(92) { string(16)
  "controllerloader" ["config"]=> string(6) "config"
- ["Application\Controller\Index"]=>
- string(26) "applicationcontrollerindex"
- ["Application\Controller\Api"]=>
- string(24) "applicationcontrollerapi"
- ["Application\Controller\Api\Website"]=>
- string(31) "applicationcontrollerapiwebsite"
- ["Application\Controller\Api\Website\User"]=>
- string(35) "applicationcontrollerapiwebsiteuser"
  ["controllerpluginmanager"]=> string(23) "controllerpluginmanager"
  ["viewhelpermanager"]=> string(17) "viewhelpermanager"
- ["validatormanager"]=>
- string(16) "validatormanager"
- ["filtermanager"]=>
- string(13) "filtermanager"
- ["formelementmanager"]=>
- string(18) "formelementmanager"
- ["routepluginmanager"]=>
- string(18) "routepluginmanager" ["application"]=> string(11)
  "application" ["request"]=> @@ -124,6 +142,8 @@ array(92) { string(16)
  "dispatchlistener" ["viewmanager"]=> string(11) "viewmanager"
- ["sendresponselistener"]=>
- string(20) "sendresponselistener" ["router"]=> string(6) "router"
  ["RouteNotFoundStrategy"]=> @@ -185,10 +205,5 @@ array(92) {
  ["zendservicemanagerservicelocatorinterface"]=> string(41)
  "zendservicemanagerservicelocatorinterface" } ```
  
  —
  Reply to this email directly or view it on GitHubhttps://github.com/zendframework/zf2/issues/3576.

Matthew Weier O'Phinney
[email protected]
http://mwop.net/

@Ocramius
Copy link
Member

@weierophinney still should be in there. We only removed the initializer, not the abstract factory.

@weierophinney
Copy link
Member

Dolf - can you provide some code - config, etc - to reproduce, please? The
container contents aren't helping me understand the conditions properly.

On Sunday, January 27, 2013, Marco Pivetta wrote:

@weierophinney https://github.com/weierophinney still should be in
there. We only removed the initializer, not the abstract factory.


Reply to this email directly or view it on GitHubhttps://github.com//issues/3576#issuecomment-12763337.

Matthew Weier O'Phinney
[email protected]
http://mwop.net/

@Freeaqingme
Copy link
Member Author

@weierophinney I got a pointer from Waly on github to remove the 'getServiceLocator()' call. Removing that, gave me the following array:

array(6) {
  ["Application\Controller\Index"]=>
  string(26) "applicationcontrollerindex"
  ["Application\Controller\Api"]=>
  string(24) "applicationcontrollerapi"
  ["Application\Controller\Api\Website"]=>
  string(31) "applicationcontrollerapiwebsite"
  ["Application\Controller\Api\Website\User"]=>
  string(35) "applicationcontrollerapiwebsiteuser"
  ["applicationcontrollerapi"]=>
  string(24) "applicationcontrollerapi"
  ["applicationcontrollerapiwebsite"]=>
  string(31) "applicationcontrollerapiwebsite"
}

Using that array, my code worked again (on 2.1). Right now, I don't have any code that allows you to reproduce this. I could see if I can set up something with the skeleton app though.

Edit: Switching back to 2.0, without the getServiceLocator() call, it works as well. Nevertheless, we still have some bc break going on.

@Freeaqingme
Copy link
Member Author

Git bisect rocks...

$ git bisect bad
8fcc2b13ee7fa564b821913abc698d8c5a15ac97 is the first bad commit
commit 8fcc2b13ee7fa564b821913abc698d8c5a15ac97
Author: Deserved <[email protected]>
Date:   Sun Jan 13 23:30:20 2013 +0000

    Issue ZF-3347: Allow Parent ServiceManager create service with the same name as in  child ServiceManager

:040000 040000 d459e07b3911fb221889cd61e36157823db91f24 28398fca95889081a48a158e29651e9bcc408b01 M  library
:040000 040000 2b4fa2ef6610d607820b652af4047510a8f0d33d 2606cb7cb023dbcebcd45b33cc7fa82a198a5057 M  tests

@ghost ghost assigned weierophinney Jan 29, 2013
weierophinney added a commit that referenced this issue Jan 29, 2013
…hotfix/3424"

This reverts commit b9d1977, reversing
changes made to 054f7a0.

Reverts #3424 due to BC breaks reported in #3576

Conflicts:
	tests/ZendTest/ServiceManager/ServiceManagerTest.php
weierophinney added a commit that referenced this issue Jan 29, 2013
Reverts #3424 due to BC issue reported in #3576

This reverts commit c8c6375, reversing
changes made to 054f7a0.
@weierophinney
Copy link
Member

@Freeaqingme Can you please test again? I've reverted the PR that introduced the issue.

@weierophinney
Copy link
Member

Cannot recreate the issue now locally.

@Freeaqingme
Copy link
Member Author

@weierophinney Fix confirmed!

weierophinney added a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
…hotfix/3424"

This reverts commit b9d19770186be6b50e9908c94d495db42034f6df, reversing
changes made to 054f7a0f95bb919cce95faa53ced0a525017602f.

Reverts zendframework/zendframework#3424 due to BC breaks reported in zendframework/zendframework#3576

Conflicts:
	tests/ZendTest/ServiceManager/ServiceManagerTest.php
weierophinney added a commit to zendframework/zend-servicemanager that referenced this issue May 15, 2015
Reverts zendframework/zendframework#3424 due to BC issue reported in zendframework/zendframework#3576

This reverts commit c8c637523fe1a5705ba01684386a8ef63e675464, reversing
changes made to 054f7a0f95bb919cce95faa53ced0a525017602f.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants